How to copy/paste from windows application to vim-

2019-06-12 03:21发布

Original question: (please read update in this section below) I am running Ubuntu 16.04 on Virtualbox on a Windows 10 Host. Accessing the Virtualbox through ssh running through Bash on Windows. I can get in and edit everything fine However, when I try to paste anything from windows application to VIM or from VIM to windows applications with keyboard shortcuts it doesnt work. None of the native keys work to copy from VIM on bash on Windows to windows apps. Within VIM copy paste works as usual.

For future visitors to this question, I thought I would compile some references to show that copy-pasting to and from windows clipboard to vim running through Putty and WSL doesnt work:

  1. Putty manual reference showing that by design you cant paste into putty from windows: https://superuser.com/a/85774/658319
  2. Running bash on WSL and ssh into a linux server cant be used to copy or paste (check COPY and PASTE at bottom of article) from windows to VIM on linux or from VIM on linux to window with keyboard only: https://alliterationapplications.com/putty-vs-ubuntu-on-windows/

Alternative software to being able to copy-paste to and from vim running on linux:

  1. Software solutions:

    1.1. kitty: https://superuser.com/a/1112362/658319

    1.2. Autohotkey: https://superuser.com/a/1112362/658319,

    1.3. Superputty: https://superuser.com/a/450812/658319

    1.4. conEmu: https://superuser.com/a/450812/658319

    1.5. using windows Mouse simulation keys: https://superuser.com/a/426311/658319

    1.6. using Gnu screen app: https://superuser.com/a/85785/658319, https://superuser.com/a/273490/658319

  2. through modificaitons on putty (didnt work for me): https://www.quora.com/How-can-you-copy-all-contents-of-a-text-file-opened-in-vim-through-Putty-on-a-Windows-desktop-to-Windows-clipboard/answer/Lifu-Tang

  3. Other editors similar to VIM which might have easier copy-paste functionality (please test and mention if these work. I will update the answer):

    3.1. NeoVIM

    3.2. Atom

  4. Connecting using SSH on Bash on Windows to linux server and copy-pasting to/from vim

    4.1. Use VCX server: https://stackoverflow.com/a/44534222/4752883 4.2. Use Autohotkey: https://stackoverflow.com/a/44534222/4752883

Any other potential suggestions for keyboard only copy-paste to vim through bash on wsl/putty/other terminal emulators to linux?

P.S. please dont post any answers which use mouse in way or form for copy paste.. trying to keep it clear here.. as most users who are asking this question are asking for a keyboard only solution.

1条回答
Animai°情兽
2楼-- · 2019-06-12 04:02

As per the putty documentation, it does not allow keyboard shortcuts because if you press any key it is reflecting on the remote machine.

https://superuser.com/questions/85772/putty-how-to-select-text-and-copy-text-using-keyboard-only

https://superuser.com/questions/490722/putty-alternative-with-keyboard-copy-paste

查看更多
登录 后发表回答