I like to use hlsearch
but I hate to keep everything highlighted after searching, to solve this problem I could simply use :nohlsearch
or an abbreviation of it but that is still to much effort so I decided to try to do that on pressing escape. What I came up with is:
nnoremap <ESC> :nohlsearch<CR>
This works exactly as I want it to in GVim which I usually use for development but it does not work in vim.
If I search something in vim, press escape to deactivate the highlighting and use one of the arrow keys to navigate vim goes directly into insert mode and inserts a character on a new line.
As I never really came around to using h
, j
, k
and l
for navigation this is really annoying and I would like to know how I can make vim behave like gvim.
If you need more information you can find my entire vim configuration here.
Your problem is that when you press <Up>
terminal sends something like <Esc>OA
(you will see it if you type <C-v><Up>
in insert mode) which is remapped to :nohlsearch<CR>OA
. I do not know any solution except not mapping a single <Esc>
, try either mapping to double <Esc>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With