When I open up vim, it starts off with :2R
already entered into the command line. I tried commenting out my entire .vimrc
, and then it opens up starting in replace mode, with the 2 key pre-pressed (in other words, I insert some text, press <ESC>
, and the text appears twice), which is the same as if I had pressed 2R
upon opening vim.
How should I go about debugging this? I don't think it can be an issue with my .vimrc
, so then what could it be?
For reference, I just updated to version 8.2 via ppa:jonathonf/vim
.
<Esc>
in any mappings in your vimrc? In my answer here notice the reference to2R
... Why does terminal vim enter replace mode with my vimrc file?<ESC>
in some mappings, but never on the left-hand side. Further, commenting out the whole.vimrc
does not stop the2R
from occurring. I opened up vim with a fully-commented.vimrc
, and used:scriptnames
to find that the only other files loaded are/usr/share/vim/vimrc
,~/.vim/filetype.vim
,~/.vimrc
, and some files from/usr/share/vim/vim82/...
.$TERM
environment variable set to?<Esc>[6n
(note:<Esc>
prints as^[
) the terminal will reply with the cursor's current row and column. (From xterm terminal you can try it yourself withecho -e "\e[6n"
.) The exact format of the response is<Esc>r;cR
. If cursor is on column 2 then you can see where2R
might come from. I'm not sure of exactly how, though, the mix of Vim and a terminal emulator with mediocre xterm emulation results in the output getting into Vim as a command.