Sublime Forum

Highlighted Instances of a Selection — Turn Highlighted into Selection

#1

I’m not sure if a plug-in I have is doing this or not, so bear with me:

If I have a variable all over the place, I can make a text selection of that variable, and all other instances of that variable are highlighted with a border around them.

This feature seems to be contextually smart. I had a variable literally named ‘o’. When I selected it, it knew to only highlight instances of it as a variable in accordance with the coding language (javascript), and disregard the o’s that appear in other words.

The issue is that I’m not finding a way to turn those smart highlights into real selections. The menu option “Quick Find All” is not smart and will select every instance of ‘o’, variable or not.

Does anyone know of a way to convert this smart contextual instance highlighting into real selections?

0 Likes

#2

I think what you want here is to just put the cursor on the o and then press the key or select the menu item for Quick Find All instead of selecting the o first.

Basically, if you have text selected, then the command literally tries to find every instance of the selected text. On the other hand if you get it to select the text for you (by just putting the cursor in the word) it will select the whole word and then infer that it should select all of the other whole words as well.

EDIT: There is more information on the various ways that this command works in this SO answer (if you ignore the part where it talks about how the same command is bound to two different keys :wink:)

0 Likes

#3

@OdatNurd - I see, if I put the caret before it, then do “Quick Find All”, it selects all instances contextually; i.e the variable instances.

This is not at all obvious, since the highlighting only appears if you select the word, and why would “Quick Find All” do anything without a selection?

I skimmed through that SO post, and I’m guessing that this is actually two separate features (highlighting, make selection) that falsely appear to be synergetic, but are not.

0 Likes