Wednesday, January 1, 2014

Vim/X11 Shared Clipboard

As far as I can tell, the best way to get Vim to share a clipboard with X11 is via the following configuration:

:set clipboard=unnamedplus
:set clipboard^=autoselect
:set guioptions+=a

The first option makes the normal clipboard work and the second is for the highlighting/middle-click one. The second one works better if you also enable the mouse (:set mouse=a).

The last one somehow helps when using gVim, which I don't use much; however, at least on Arch and Ubuntu, it seems to be necessary to have the gVim package ("gvim" in Arch, "vim-gnome" in Ubuntu, I think) so that any of these options have an effect. I suppose it makes sense to leave out any X11-related features of the console-only package.

No comments:

Post a Comment