Sublime Forum

Find in contexts

#1

It would be really nice to have the option to include/exclude certain contexts from Find.

the most obvious use case is: I want to find all the occurrences of “foo” in my file, ignoring the comments.

4 Likes

#2

Any news on this?

0 Likes

#3

my current solution is to execute view.find_by_selector('- comment') in the ST console and then do a find in selection. It doesn’t help when doing a Find in Files, though, unfortunately

1 Like

Find but exclude comments
#4

That is a reasonable fix. However, I do not get this working. First select, then execute this command?

It would be great though to have a button for this…!

0 Likes

#5

oh, sorry, I missed a step, was typing on my phone at the time :wink:

view.sel().clear(); view.sel().add_all(view.find_by_selector('- comment'))

0 Likes

#6

You can take a look at my answer on SO

2 Likes