WordHighlight icon indicating copy to clipboard operation
WordHighlight copied to clipboard

highlight match all occurrences (Vintage/Ex), not word under cursor

Open cre8value opened this issue 13 years ago • 8 comments

Great plugin, looking to tweak it so that it works like Vim match behavior. Is there a way to config WordHighlight to only highlight matches in Vintage mode or VintageEx instead of the word under cursor? And to keep matches highlighted until new search word is searched for, no matter what word my cursor is on?

Here is what it looks like in Vim after I type: /highlight No matter where I move my cursor, all occurrences of 'highlight' will be highlighted in red until I search for a new phrase. Can this be done with WordHighlight?

image

cre8value avatar Mar 01 '13 18:03 cre8value

No, it can't do that.

adzenith avatar Mar 01 '13 18:03 adzenith

Thank you for the quick response. Any suggestions on how to accomplish that behavior in ST2 or where to find the resources on how to implement something like that? Going into Insert mode and then hitting ALT F3 or CTRL-F then ENTER just isn't the same for us coming from years of Vim. Thanks again.

cre8value avatar Mar 01 '13 18:03 cre8value

What does Sublime Text do right now? If you search and then move your cursor, you lose the search? You'd have to write a plugin. You could probably adapt WordHighlight pretty easily, actually. I don't use VI mode, though, so I can't really speak about how I'd integrate it.

adzenith avatar Mar 01 '13 18:03 adzenith

Correct, upon cursor move it loses highlight. Plus it doesn't highlight all occurrences.

image

cre8value avatar Mar 01 '13 19:03 cre8value

As an aside coming from vim/gvim as well (with Vintage Mode enabled) the reason why I searched for a better highlight plugin is probably one of the best shortcuts in vim:

Pressing * (star) in gvim as well as Sublime Text 3, searches for the current word. And in both vim and ST3, pressing n or shift-n afterwards will move to the next / previous match.

This is incredibly simple and useful. I use this all the time when refactoring or just reading code I wrote some time ago. Press * on a variable and you can instantly see where it's used.

However unlike vim, in ST3 (+ Vintage Mode) when you press * the matches are not highlighted at all (including with this package).

Do you think it's possible to mod this plugin to do the matches highlighting when I press *? I can try to do that myself.. I've just never looked into the ST3 plugin system.

ps: Ok, with this package, if I double click a word, I see the matches. That's an improvement. However I can't automatically move to the next/prev matches with n / shift N. i'd like to make that double click functioanlity work with * and then be able to navigate the matches.

fabd avatar Sep 18 '18 13:09 fabd

Sublime Text has this built in, I think, but only if you have the find panel open. Try pressing cmd+f (or ctrl+f on win/lin) and then go back in your buffer and see if when you press * everything gets highlighted.

adzenith avatar Sep 28 '18 16:09 adzenith

As an aside coming from vim/gvim as well (with Vintage Mode enabled) the reason why I searched for a better highlight plugin is probably one of the best shortcuts in vim:

Pressing * (star) in gvim as well as Sublime Text 3, searches for the current word. And in both vim and ST3, pressing n or shift-n afterwards will move to the next / previous match.

This is incredibly simple and useful. I use this all the time when refactoring or just reading code I wrote some time ago. Press * on a variable and you can instantly see where it's used.

However unlike vim, in ST3 (+ Vintage Mode) when you press * the matches are not highlighted at all (including with this package).

Do you think it's possible to mod this plugin to do the matches highlighting when I press *? I can try to do that myself.. I've just never looked into the ST3 plugin system.

ps: Ok, with this package, if I double click a word, I see the matches. That's an improvement. However I can't automatically move to the next/prev matches with n / shift N. i'd like to make that double click functioanlity work with * and then be able to navigate the matches.

Hey I am having similar issue here. Do you happen to find a solution for that?

harouwu avatar Mar 13 '19 15:03 harouwu

Sublime Text has this built in, I think, but only if you have the find panel open. Try pressing cmd+f (or ctrl+f on win/lin) and then go back in your buffer and see if when you press * everything gets highlighted.

I have search panel opens, but I can only press * again after using mouse to click on the searched word. It would be really good if I can keep pressing * with highlighted keywords without using my mouse

harouwu avatar Mar 13 '19 15:03 harouwu