FreeBSD

FreeBSD: how to enable clipboard on Vim

Vim editor

If you have asked yourself “how to enable clipboard on Vim?” or “is it possible to access the system clipboard on Vim?“, the answer is: yes. This is how you can do it.

Note: in this example I’m using FreeBSD, but the principle is the same in other *nixes.

First, you need to get sure that you installed Vim package was compiled with xterm_clipboard compatibility. If instead of +xterm_clipboard you see -xterm_clipboard, your Vim package was not compiled with clipboard support.

$ vim --version | grep -i clipboard
+clipboard         +keymap            +printer           +vertsplit
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard

If this happens to be your case, then you should install the vim-x11-* package, or in my case (as I was interested in have GVim installed), the vim-gtk3-* package.

$ sudo pkg install vim-gtk3-9.0.0016

Now you should have access to the desktop clipboard.

Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *