I'm trying to figure out how to get vim inside PuTTY (no xterm involved) to interact with the Windows clipboard.
My research so far indicates it's not possible. xterm has clipboard-interaction terminal escape sequences, but they're disabled by default in xterm. They're probably not implemented at all in PuTTY. This is probably for security reasons: you don't want a remote system to have full access to your clipboard.
I'm not sure if that's what vim's xterm_clipboard
feature is supposed to use, anyway. My searching so far only turns up people complaining about it not being enabled, or talking about how to get a vim that has it enabled, not how it's actually implemented. The best I've found is this guide which mentions it, but doesn't say anything that would pin it down to escape sequences vs. X selection vs. X clipboard. (Yes, X11 has a selection and a separate clipboard. Some ways of copying only set one or the other.)
Vim's clipboard support talks directly to the X server. On a Linux desktop, with vim in a terminal (Konsole in my case) :"*dd
does put the lines into the clipboard.
With
(unset DISPLAY; strace -s256 -o /dev/pts/18 vim some_file.txt)
vim doesn't have an X server to talk to. (pts18
is the tty of another terminal window.) I thought vim might use xterm escape sequences to set the clipboard, but it doesn't. There is no write(1, ...)
system call with the whole region, so it's clearly not trying to use an escape sequence to put the region in the clipboard via xterm.
I ran this inside a Konsole with TERM=xterm
, on Ubuntu 15.04. I also tried inside a real xterm
.
Oh, xterm disables GetSelection/SetSelection
by default. Maybe with this enabled, vim would try to use it? IDK if this helps, though, because PuTTY would also have to support it, which is unlikely.