Today, I wanted to import a public GPG key. To do so, I have navigated to page, copied the key, opened up vim, entered insert mode by pressing i and pasted the text.
Every line has been pasted fine except the following line:
EgdlR1BHAAEBCRCMcY07UHLh9bDbAJ4mKWARqsvx4TJ8N1hPJF2oTjkeSgCeMVJljxmD+Jd4
That line appears as:
gCeMVJljxmD+Jd4
Note that this corresponds to trailing part of the line.
Then I have exited from the insert mode and pressed u. Now, the line has been turned into:
EgdlR1BHAAEBCRCMcY07UHLh9bDbAJ4mKWARqsvx4TJ8N1hPJF2oT
Note that this corresponds to the beginning portion of the line.
All in all, the only characters not present in any of the two forms are:
jkeS
My speculation is, for some reason, when text is pasted, this character sequence acts like a command that says: 'Delete all characters in this line, up to this point'. I can reproduce the behavior with a line like:
aaaajkeSbbbb
So, I have two questions regarding this:
- Why exactly does this character sequence,
jkeS
, causes this behavior? What is going on behind the scenes? - What exactly is the use case for this behavior? I think there must be a use case for this because this is AFAIK a feature, not a bug. Even, there is a paste mode in vim which we activate by typing
:set paste
for correct pasting, which is a fact that supports that this 'weird' pasting behavior is a feature, definitely not a bug.
set pastetoggle=<F2>
in my.vimrc
and press <F2> before & after pasting