mskyaxl / wsl-terminal

Terminal emulator for Windows Subsystem for Linux (WSL)
MIT License
3.12k stars 158 forks source link

how to copy code from vim in wsl-terminal then paste to windows app? #122

Closed ParadoxZW closed 4 years ago

ParadoxZW commented 5 years ago

鼠标选中再CTRL+Insert的方法会把vim的行号也复制进去,关行号太麻烦,而且鼠标没法选中超过两页的代码,请问一下要怎么解决啊?

ParadoxZW commented 5 years ago

I want to copy the code that I wrote in vim with wsl-terminal to the Windows clipboard, but I don't know how to do? please help me. 'Cause vim has number, so the Shift-Insert way is helpless.

HaraldWeber commented 5 years ago

Copy/Paste doesn't work for me when I start vim from vim.exe. If you start "open-wsl -l" and type vim copy/paste works fine with the following line in ~/.vimrc

" make yank copy to the global system clipboard (windows)
set clipboard=unnamed

Then you can for example paste the windows clipboard with p. You can normally yank (copy) with y.

mskyaxl commented 4 years ago

you need to setup a xserver for this to work properly. UPDATE: the xserver is required only when working with tmux

with bash/zsh and vim: set clipboard^=unnamed,unnamedplus is enough