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:
That line appears as:
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:
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:
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:
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 pastefor correct pasting, which is a fact that supports that this 'weird' pasting behavior is a feature, definitely not a bug.