Search code examples
vimclipboardcopy-pasteyank

CLIPBOARD and PRIMARY registers don't work on my Linux


If I want to copy/paste something to/from a register I have no problem. For example if I'm in Visual Mode and I press "ay the selected region get correctly copied to register a (and if I press "ayy in Normal Mode, the line under the cursor get correctly copied into a).

During the sequence I can see the characters I pressed in the bottom bar.

If I try to hit one of the sequences "*yy, "*dd, "+yy or "+dd, when I press the double quotes they appear in the bottom bar, but when after this I press * or + the sequence in the bottom bar disappear and if I complete the sequence, it doesn't copy anything to the CLIPBOARD and PRIMARY selections.

System: ArchLinux

Window manager: suckless DWM

Terminal: bash on suckless ST


Solution

  • You're missing +clipboard support in your Vim.

    On ArchLinux, you can get a Vim with +clipboard support by installing the gvim package.

    See Vim Installation on the ArchLinux wiki, more specifically this note:

    The vim package is built without Xorg support; specifically the +clipboard feature is missing, so Vim will not be able to operate with the primary and clipboard selection buffers. The gvim package provides also the CLI version of Vim with the +clipboard feature.

    The gvim package will include a new gvim command for a GUI version of Vim, but it will also include a regular console vim command, only that one will have support for +clipboard when running inside a terminal attached to an X11 display.