This one is driving me mad. I'm using XTerm(330) and the latest vim 8.0.1365 (on FreeBSD).
Sometimes, not always, about 1 in 5, when I open a file with vim, a funny line is inserted above line 1. After a lot of head scratching, I realized it is the last line I deleted in a previous session. In other words, it looks like
""P (paste the
" register) is run.
After some more investigation, I found this only happens when I have
*sunKeyboard: true set in the XTerm resources, and when I use a rendered font, such as
-fa "DejaVu Sans Mono:size=24". (I told you it was strange, didn't I?). I have no
.vimrc and no
.vim directory, to avoid any plugin playing tricks on me.
I can reproduce the effect somewhat with the following commands:
#!/bin/sh rm -f .viminfo; echo inserted >bar; echo x >baz vim -c d -c wq bar echo '*sunKeyboard: true' > XTerm export XAPPLRESDIR=$PWD for i in 1 2 3 4 5 6; do xterm -fa "DejaVu Sans Mono:size=24" -e vim baz done
This will create the necessary files, place
inserted in the
" register and invoke vim a few times. If you see a one line file with
x in the first line, all is fine; enter
q for the next invocation. If however you see
you have reproduced the problem. Note also that the last character of line 1 has been replaced by
2. This seems to come from the
. register. Here are the registers:
:reg --- Registers --- "" inserted^J "1 inserted^J ". 2 "% baz
- Trying the script several times, can you reproduce the problem? Be sure to move
.vimtemporarily out of the way.
- If so, can you tell me what is going on here?
- Any suggestions how to get to the bottom of this?
Looks like I'm not the only one: https://github.com/vim/vim/issues/2238