I am having a weird bug in my .vimrc
since I last updated it.
Every time I start vim it starts in -- REPLACE --
mode which is really annoying.
I managed to find out that it is this line in my .vimrc
that is causing the problem.
" Disable search highlighting temporally
nnoremap <esc> :nohl<cr>
The problem goes away when I comment this line out.
I am really confused about what is wrong with the mapping. It works as it should but causes vim to enter -- REPLACE --
mode on startup.
I currently have no plugins enabled at all.
Flag t_u7 is set by default and so vim will request cursor position and get a bad reply from the ssh client. Workaround: Adding set t_u7= or set ambw=double to your vimrc should fix the problem. set t_u7= will disable requesting cursor position and ambw=double will set the ambiguous characters mode to double.
By default, Vim starts in “normal” mode. Normal mode can be accessed from other modes by pressing Esc or <C-[> .
You can press R and you'll get into the REPLACE mode. Shift+R, actually. Pressing just R key (as you would do to type r ) allows to replace just one letter and then goes back to NORMAL mode. Possibly that's why he put R and not r.
I had this same problem, though it was inside of tmux, when I started vi (aka vim), it would launch in REPLACE mode. The culprit seems to be the TERMCAP definitions for the TERM I have been using: xterm-256color.
Once I set TERM to something different, vi (vim) worked correctly. Even a TERM setting of "ansi" behaved better.
I settled on a TERM setting of "screen-256color-s" which works as I need.
Fun with TERMCAP definitions.
It is better to avoid mapping the Esc key, as it is known to cause strange behavior:
I have been using <leader><space>
for disabling the highlighting, as suggested by "Coming Home to Vim", maybe you could get used to it too.
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