This question already has an answer here:
- Why can't I paste commands into vi? 2 answers
I use command-line vim in xterms (actually
TERM=rxvt-unicode) and have long been used to allowing X to manage all mouse interactions, with vim remaining blissfully unaware of the difference between manual keystrokes and pasted text.
Today, I made my first test install of the Debian buster release, which comes with vim 8.1. I went to create a new
vimrc.local to turn off
mouse=a by manually entering
:set mouse=, and then copying (mouse highlight) and pasting (middle-click) the text:
:set paste O let g:skip_defaults_vim = 1 set mouse=
In the previous Debian release, with vim 8.0, this behaved exactly as if I had typed those characters by hand - it turned on
paste, then opened a new line in insert mode, and added the two commands to the file.
With the new version, however, vim apparently sees "Oh! He's pasting with a mouse!" and immediately goes into insert mode, resulting in the file including all four lines. This effectively makes it impossible to paste any kind of commands, only allowing the mouse to be used to insert text.
Based on some web searches, I have tried using
:set ttymouse= in addition to
set mouse=, but this has not affected the "force insert mode when pasting with the mouse" behavior. It is definitely not anything to do with my X environment, as I can have two xterms open side-by-side to different machines and see the old behavior in the window sshed to the machine with vim 8.0 and the new behavior in the window sshed to the machine with vim 8.1.
How do I restore the previous behavior?