diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 65405fc..6f59079 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -301,7 +301,6 @@ vnoremap < -1 ? 'zv' : '' @@ -313,9 +312,10 @@ function! s:CenterNext(count, command) let &lazyredraw = l:lazyredraw_bkp endfunction -" TODO: does not rehighlight search results -map n call CenterNext(v:count1, 'n') -map N call CenterNext(v:count1, 'N') +" NOTE: v:hlsearch's value is restored when returning from a function and thus +" needs to be set here (see :h function-search-undo) +map n call CenterNext(v:count1, 'n') let v:hlsearch = 1 +map N call CenterNext(v:count1, 'N') let v:hlsearch = 1 cnoremap "" . \ (getcmdtype() == '/' \|\| getcmdtype() == '?'