In vim, is there a way to cancel a search *without* resetting the cursor position? -


in vim, have hlsearch , incsearch turned on. when start search, goes first match. if press return accept search, result highlighted , cursor positioned @ first match. if press esc cancel, cursor position reset wherever when started search.

is there way in case make esc cancel search leave cursor position on first match? way i'd end in right spot without highlighted.

thanks!

you use :nohl after hitting <enter> cancel highlighting.

you make easy switch between highlight mode , non-highlight mode using mapping:

" put in vimrc nnoremap <space> :set hls!<cr> 

alternately, use mapping clear out current search term.

" put in vimrc nnoremap <space> :let @/=""<cr> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -