Sublime Forum

How to select surrounded word?

#1

When I select a word, the same words are surrounded like below.

But [Selection]-[Expand Selection to Word] selects any words contains selected word (In the image, “foobar” will be selected).

How to select only surrounded words?

0 Likes

#2

Sublime has some special behaviour around this. If you use Expand Selection to Word with only the cursor in the middle of the word (which will expand to highlight the whole word) then further calls to Expand Selection to Word will only select the highlighted words (like you want). But if you start from a selection (the whole word is already selected) and then use Expand Selection to Word it will search for any occurrence of that character sequence in that file. Make sense?

0 Likes

#3

That makes sense! Thank you!

0 Likes