SublimeText / WordHighlight

Highlight all copies of the currently selected word.
MIT License
179 stars 24 forks source link

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

Open cre8value opened 11 years ago

cre8value commented 11 years ago

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

adzenith commented 11 years ago

No, it can't do that.

cre8value commented 11 years ago

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.

adzenith commented 11 years ago

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.

cre8value commented 11 years ago

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

image

fabd commented 6 years ago

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.

adzenith commented 5 years ago

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.

harouwu commented 5 years ago

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 commented 5 years ago

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