Skip to main content

How to copy to clipboard in Vim?

· One min read

Requirements

$ vim --version | grep clipboard

+clipboard +keymap +printer +vertsplit
+eval -mouse_jsbterm -sun_workshop +xterm_clipboard

if clipboard is -, then we need install vim-gtk.

for example, on ubuntu:

$ sudo apt install -y vim-gtk

Settings

vim ~/.vimrc

On macOS and Windows set:

$ set clipboard=unnamed

On Linux set (vim 7.3.74+):

$ set clipboard=unnamedplus