Is there a way in vim to reconfirm "*" to highlight the current word without moving on to the next?

I often use * to highlight all instances of the current word, and the fact that it advances to the next word is quite annoying. I would like to disable this behavior, knowing that I can always use "n" if I really need to move forward.

Any insight?

EDIT: I have to add that I would like to avoid redrawing the screen at all costs, as it is visually distracting.

+3
source share
4 answers

Try the following:

nnoremap * :let @/ = "\\<<C-R><C-W>\\>"<CR>

(, 'hlsearch'). ( \< \> ). hlsearch, . n n .

:

:help :let-@
:help quote/
:help c_CTRL-R_CTRL-W
+9

Vim. . , .

+2

, Vim Tip , .vimrc, , Vim .

...

+1

:

nnoremap * '*N'

( )

+1

Source: https://habr.com/ru/post/1795717/


All Articles