Sublime Forum

Alt-f3 (search all under)

#1

hi jon, did you change the behavior of the alt-f ‘search all under’? it used to select all under, and to also use the selected text as the new search string. i see that now it just select it all over the file, but the search string is not updated, so pressing f3 after alt-f3 will search the string i searched before.

is this change intentional?

vim.

0 Likes

#2

I’m not able to reproduce this, my steps are:

  • Navigate the cursor to a word
  • Press Alt+F3: all occurrences of the word are selected
  • Press F3: the first occurrence of the word is selected. Pressing again goes to the next etc.

I’m not able to get F3 to use the wrong search term. Is this the set of steps you are using?

0 Likes

#3

after your reply i have searched all the packages for another use of alt+f3. SearchInArea package was using it, and probably caused this problem.

i have removed the package and it is all back to normal, thanks!

btw, do you remember the sticky search feature? i guess that with the new API for findAll i can partially implement it, but i was hoping to be able to mark text with other colors.

0 Likes

#4

It’s not forgotten about, and I’m keen to see it. I’m not quite sure when it’ll make it in though.

0 Likes

#5

i had little problems writing a searchAllUnder-like plugin:

import sublime, sublimeplugin

class StickySearchCommand(sublimeplugin.TextCommand):
	def run(self, view, args):
		selection = view.sel()[0]
		if selection.begin() - selection.end() != 0:
			pattern = "\<" + view.substr(selection) + "\>"
		else:
			pattern = "\<" + view.substr(view.word(selection)) + "\>"
		
		# mark new region
		region_list = view.findAll(pattern)
		# reset selection
		view_selection = view.sel()
		view_selection.clear()
		# add new selection
		for region in region_list:
			view_selection.add(region)
		

but (of course) it won’t stick… i need the selection to stick even if i do another regular search (ctrl-f/f3/alt-f3/etc.) i also need a way to alter the selection color to make it unique. in my experience this feature is very valuable, when you browse your code and want to instantly highlight keywords.

0 Likes

#6

Yes: the contents of the view in the find panel is the source used for find next etc.

0 Likes