Once in a while, I need to use Putty on Windows to connect to a guest Linux installation in VirtualBox for things that aren’t compatible with Cygwin. However, a slight annoyance is that I can’t copy, say, a whole file to the Windows clipboard.
After some research, I found PuttyClip, which is essentially a patch on Putty that adds an option to allow the remote to send ANSI escape codes (AUX port on/off) to modify the local clipboard.
However, the putty version provided is outdated, and does not support some new cipher standards. Shortly after, I realized the Putty fork I had been using, KiTTY, has the patch included.
With the client set up properly, the only thing left is to write a script on the remote box that sends the ANSI codes.
echo -ne '\e[5i'
echo -ne '\e[4i'
Which can then be called by
[scriptName] [textFile] or
cat [textFile] | [scriptName]. However, this does not work on Tmux. A solution is the following:
echo -ne '\ePtmux;\e\e[5i\e\\'
echo -ne '\ePtmux;\e\e[4i\e\\'
This creates some escape codes at the beginning of the content, which look positioning related. I have no idea on how to remove them, but manually deleting them (at least for my usage) isn’t that much of a problem.