How can I select every other line with multiple cursors in Sublime Text?

user2136580 picture user2136580 · Mar 24, 2013 · Viewed 70.7k times · Source

In Sublime Text 2, is it possible to instantly select every other (or odd/even) line and place multiple cursors on those lines?

Thanks.

Answer

Joe Daley picture Joe Daley · Apr 29, 2013
  1. Find: Ctrl+F
  2. If regular expressions are not already enabled, enable them: Alt+R
  3. Type in the expression .*\n.*\n
  4. Find all: Alt+Enter
  5. Press left arrow to get rid of the selections, leaving just the cursors:
  6. You now have a cursor at the start of every odd-numbered line. If you wanted even-numbered lines, press down:
  7. Depending on the file, there might be one cursor missing right down the bottom of the file. Using the mouse (damn!) scroll to the bottom, hold down Ctrl, and click where the missing cursor should be to add it in.