0

Background: I'm using the terminal version of Vim. I found this guide mentioning a way to use the ESC key to clear highlighted text from a previous regex search.

Putting the mapping map <esc> :noh<cr> into my vimrc file does produce the desired effect...BUT:

(1): It causes vim to start in "Replace" mode
(2): It breaks the arrow keys (they don't move the cursor, but insert characters instead).

In this Stackoverflow question, it is addressed that using the mapping nnoremap <esc> :noh<return><esc> will do the job, but works without issues only with a GUI, and causes problems when not using a GUI (my situation).

Can this mapping be fixed? If not, why can't I use the escape key to clear text highlighting.

My vim version is: VIM - Vi IMproved 8.1

Community
  • 1
  • 1
I_Don't_Code
  • 117
  • 11

0 Answers0