Well, I try to use the following convention. ± (as unused key) is used for increase search where / is used for regular search.

The implementation:

set noincsearch

nmap  ± <esc>:set incsearch<CR>/

augroup vimrc-noincsearch-highlight
  autocmd CmdlineLeave / :set noincsearch |  :noh 
augroup END

Everything works fine.

The only tiny problem is that I get a beep every time I use it!

I tried to use other keys as well, but I get the same anonying beep.

Temporary solution:

set visualbell t_vb=



  • 2
    The beep is probably from <esc>; does it work if you remove that and use nnoremap ?
    – D. Ben Knoble
    Oct 26, 2018 at 3:07
  • Will post answer later
    – D. Ben Knoble
    Oct 26, 2018 at 23:59

1 Answer 1

nmap  ± <esc>:set incsearch<CR>/

<Esc> in normal mode issues a beep. Your :nmap is a normal mode mapping; no <esc> is necessary here. You could use <C-u> to swallow any accidental [count], though. And you should use :noremap; it makes the mapping immune to remapping and recursion:

nnoremap  ± :<C-u>set incsearch<CR>/

Though not needed here, there is a special mapping that ensures normal mode without a beep: :help CTRL-\_CTRL-N

Additionally the command CTRL-\ CTRL-N or can be used to go to Normal mode from any other mode. This can be used to make sure Vim is in Normal mode, without causing a beep like would. However, this does not work in Ex mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.