wsl vim无法复制到系统剪贴板,解决方法

工作原因现在改用windows了,有些不习惯,又不想使用虚拟机,于是尝试使用wsl。不知道会有多少坑。现在的坑是vim无法复制到系统的剪贴板里。

具体可通过一下命令确认:

$ vim --version | grep "clipboard"
-clipboard         +keymap            +printer           +vertsplit
+emacs_tags        +mouse_gpm         -sun_workshop      -xterm_clipboard

科学上网稍微看了下,原因大概就是wsl里面装的是阉割版本的vim,想要使其支持系统剪贴板,需要

No +clipboard?
Vim requires the +clipboard feature flag for any of this to work; you can check if your Vim has this by using :echo has('clipboard') from within Vim (if the output is 0, it's not present, if it's 1, it is), or checking the output of vim --version for +clipboard.

Most Linux distributions ship with a "minimal" Vim build by default, which doesn't have +clipboard, but you can usually install it:

Debian & Ubuntu: Install vim-gtk3.

参考How can I copy text to the system clipboard from Vim?

安装vim-gtk3后,可以拷贝到系统剪贴板了。Great

你可能感兴趣的:(工作环境配置)