How can I highlight all occurrence of a selected word in GVim, like in Notepad++?
to highlight word without moving cursor, plop
" highlight reg. ex. in @/ register
set hlsearch
" remap `*`/`#` to search forwards/backwards (resp.)
" w/o moving cursor
nnoremap * :execute "normal! *N"
nnoremap # :execute "normal! #n"
into your vimrc.
What's nice about this is g* and g# will still work like "normal" * and #.
To set hlsearch off, you can use "short-form" (unless you have another function that starts with "noh" in command mode): :noh. Or you can use long version: :nohlsearch
For extreme convenience (I find myself toggling hlsearch maybe 20 times per day), you can map something to toggle hlsearch like so:
" search highlight toggle
nnoremap st :set hlsearch!
.:. if your is \ (it is by default), you can press \st (quickly) in normal mode to toggle hlsearch.
Or maybe you just want to have :noh mapped:
" search clear
nnoremap sc :nohlsearch
The above simply runs :nohlsearch so (unlike :set hlsearch!) it will still highlight word next time you press * or # in normal mode.
cheers