Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command to select everything between a range of cursors in sublime?

My circumstance:

I'm working with Fortran. Sometimes, I want to select everything that's within a block of code. It's easy for me to select the start/end elements of a block because it all look like this:

SUBROUTINE FOO(BAR)
IF (BAR .GT. 1) THEN
    //DO SOMETHING
ENDIF
RETURN
END SUBROUTINE FOO

Move the cursor to SUBROUTINE, Hit Ctrl+D twice, done. Both instances of the SUBROUTINE keyword are highlighted.

But now I want to select everything between the SUBROUTINE keywords. I want a selection that includes everything from the start of the first SUBROUTINE to the end of the second SUBROUTINE. I prefer this be done in language agnostic manner, because I can imagine circumstances like this might occur in other contexts and I don't want to bother accumulating muscle memory for something that only works in Fortran.

Is there a command in sublime to select all text that occurs between the start and end positions of a multicursor selection?

like image 616
16807 Avatar asked Jun 17 '15 22:06

16807


People also ask

What does Ctrl d do in Sublime Text?

Quick Add Next. To add the next occurrence of the current word to the selection, use Quick Add Next, which is bound to Ctrl+D on Windows and Linux, or Command+D on OS X. Again, if you go too far, use Undo Selection (Ctrl+U, or Command+U on OS X) to step backwards.

How do you select everything before the cursor?

To move to the start or end of the document, press Ctrl+Home or Ctrl+End. To select everything from the current position of the text cursor to the start or end, press Shift+Ctrl+Home or Shift+Ctrl+End. To jump to the next or previous word, hold down the Ctrl key while pressing the left or right arrow keys.


1 Answers

There's a group of commands in sublime that approximate this behavior. They're exposed through the CTRL+K combo keys:

  • set_mark, CTRL+K, CTRL+Space
  • select_to_mark, CTRL+K, CTRL+A
  • delete_to_mark, CTRL+K, CTRL+W

Search for the first result, call set_mark, search for the second, call select_to_mark.

like image 113
16807 Avatar answered Nov 15 '22 09:11

16807