In an unconfigured Vim, I want to do ':set paste
' right away
Recently I wound up using a FreeBSD machine, where I promptly installed vim for my traditional reason. When I started modifying some files, I had contents to paste in from another xterm window, so I tapped my middle mouse button while in insert mode (ie, I did the standard xterm 'paste text' thing). You may imagine the 'this is my face' meme when what vim inserted was the last thing I'd deleted in vim on that FreeBSD machine, instead of my X text selection.
For my future use, the cure for this is ':set paste
', which turns off
basically all of vim's special handling of pasted text. I've
traditionally used this to override things like vim auto-indenting
or auto-commenting the text I'm pasting in, but it also turns off
vim's special mouse handling, which is generally
active in terminal windows, including over SSH.
(The defaults for ':set mouse
' seem to vary from system to system
and probably vim build to vim build. For whatever reason, this
FreeBSD system and its vim defaulted to 'mouse=a', ie special mouse
handling was active all the time. I've run into mouse handling
limits in vim before, although things
may have changed since then.)
In theory, as covered in Vim's X11 selection mechanism, I might be
able to paste from another xterm (or whatever) using "*p
(to use
the '"*
' register, which is the primary selection or the cut
buffer if there's no primary selection).
In practice I think this only works under limited circumstances
(although I'm not sure what they are) and the Vim manual itself
tells you to get used to using Shift with your middle mouse button.
I would rather set paste mode, because that gets everything; a vim
that has the mouse active probably has other things I don't want
turned on too.
(Some day I'll put together a complete but minimal collection of vim settings to disable everything I want disabled, but that day isn't today.)
PS: If I'm reading various things correctly, I think vim has to be built with the 'xterm_clipboard' option in order to pull out selection information from xterm. Xterm itself must have 'Window Ops' allowed, which is not a normal setting; with this turned on, vim (or any other program) can use the selection manipulation escape sequences that xterm documents in "Operating System Commands". These escape sequences don't require that vim have direct access to your X display, so they can be used over plain SSH connections. Support for these escape sequences is probably available in other terminal emulators too, and these terminal emulators may have them always enabled.
(Note that access to your selection is a potential security risk, which is probably part of why xterm doesn't allow it by default.)
|
|