Sublime Forum

ST3 - Quick Add/Find Match behavior

#1

Suppose I’m working with a file that contains multiple occurences of a single character variable, c, which I want to rename to another name.

When I select one instance of that variable with my cursor, Sublime text automatically highlights the other instances of that variable for me:


This visual highlight is enabled by the the setting: "match_selection": true, and clearly shows that sublime is smart enough to only highlight other instances of that character where it is relevant as a variable.

However despite this highlight indicating that it should be possible, it seems there is no easy way to now automatically select just these highlighted c variables.

If I want to quickly rename all instances of the variable c using multiple cursors, either with Quick Add Next (cmd+D) or Quick Find All (ctrl+cmd+G) instead of selecting only that variable c, I get every single instance of the character ‘c’ selected:


This is obviously not useful at all, since it has no correlation to the actual variable; It just blindly selected all letters ‘c’, regardless of if they are the selected variable or not. Am I missing something?

Is there a way to force Quick Add Next and Quick Find All, to behave like the highlighting rules that the ‘match_selection’ setting uses? This would be much more useful in this case than simply blindly selecting every instance of the selected character(s).

Am I missing something? I can’t find a Quick Find All Instances or Quick Add Next Variable option, or any way to customize the default behavior of Quick Find All/Quick Add Next. As far as I can tell, my only options are to either manually rename every instance of c, or write some custom regex in an attempt to achieve the same result as the original highlighting algorithm.

0 Likes

#2

This was answered on Superuser.com

0 Likes