azabiong / vim-highlighter

Highlight words and expressions
MIT License
237 stars 11 forks source link

[Question] How to navigate highlighters in current buffer? #6

Closed jqhr closed 2 years ago

jqhr commented 2 years ago

I like this plugin very much! I got some trouble when I browse my code. For example, I highlight some keyword and I want to find next keyword, I could use *, but I don't want change my current search pattern.In addition, some keyword was highlighted by visual select, so * was not work. Just like this: 图片

The cursor was on imUserNameList, and I want to goto the next "imUserNameList" position off the screen. So, how can I do?

azabiong commented 2 years ago

I'm glad you liked this tool, and thanks for your comment. I think it could be a useful feature request. So, as a first step, in this picture, when the cursor is over the world 'imUserNameList', which key would you use to jump to the next matching word?

jqhr commented 2 years ago

I'm very happy for your replay. For me, I would use to move to next position. Thank you very much.

azabiong commented 2 years ago

Now Hi > and Hi < commands are added to support jumping to the most recently set highlight. Please find a brief summary :h Hi>  and I would like to recommend that you try the suggested key maps at first time.

Now set highlight on 'imUserNameList' and input your search pattern, and jump to the patterns. Now to jump back to the highlighted 'imUserNameList' ? Yes, simply pressing Enter should work according to the suggested key map.

azabiong commented 2 years ago

As a next step I think we can try to jump using the highlighted pattern at the cursor position. In this case, when we move the cursor from the highlighted word Before to After, the next jump pattern will be After. What do you think?

jqhr commented 2 years ago

I think so.

azabiong commented 2 years ago

Thank you, then I'll go ahead and let you know if there is an update.

azabiong commented 2 years ago

Hi Jinq, Now Hi> command supports jumping to matching highlights at the cursor position, and the new command Hi} supports jumping to adjacent highlights. Please see Jump to Highlight section and my key-map recommendation. I hope you like it 😄

jqhr commented 2 years ago

I have tried it. Great job! I like it

azabiong commented 2 years ago

Thank you, I added your name to the credits section :h Hi-Credits of v1.50.2 for suggesting this useful feature. 😄

jqhr commented 2 years ago

Thank you very mutch