Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use putty (windows) to connect to a remote machine and my daily work revolves around coding in vim. I have to copy paste from the windows clipboard a lot, and for that I use the Shift+Insert key combination of putty. Is there a way by which I can map this combination in vim . Is there anyway I can map this to leader+p combination so that I dont have to reach all the way to insert every time?

share|improve this question
    
Did you try anything? –  romainl Aug 30 '13 at 5:35
1  
Trying something would be good. See ":help i_CTRL-V" and ":help i_CTRL-K" for ways to see the keycodes received by Vim. However, I don't think there is any way to do what you want. Shift+Insert is intercepted by PuTTY before it gets to Vim, so Vim never sees those keys. Further, any mapping you do of leader+p is going to be interpreted by Vim, and there is no mechanism for Vim to tell PuTTY to paste. Vim would need access to the Windows clipboard and it can't do that over a PuTTY connection. –  garyjohn Aug 30 '13 at 7:00

1 Answer 1

As garyjohn explained, remote ViM and local PuTTy are not aware of one another, so you can neither tell PuTTy to send anything (i.e. leader+p) except clipboard text to remote ViM, nor tell remote ViM to ask PuTTy for the clipboard content.

You can try a couple of things though:

  • Install AutoHotkey or some other automation tool on your local machine, and map some key combination to send "leader+p Shift-Ins" to your current window (PuTTy).
  • Mount the directory on your remote machine to a locally accessible drive (e.g using Samba, FTP, SFTP etc), and edit the file with your local ViM.
  • Connect to remote machine using VNC client that allows you to access your Windows clipboard (e.g. RealVNC), and edit the file using remote gVim in your VNC session.

Hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.