mugnozzo
mugnozzo

Reputation: 220

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

Upvotes: 1

Views: 896

Answers (2)

Haru Hoshizora
Haru Hoshizora

Reputation: 69

Either install gvim or use original vim from github and compile it yourself.

But before compiling it run this in cloned folder

./configure --with-x --enable-gui=auto --enable-fail-if-missing

--with-x enables X11 support. --enable-gui=auto allows GUI-related features, including clipboard. --enable-fail-if-missing ensures the build process fails if any necessary libraries are missing.

then run

make
sudo make install

then to check if you have working clipboard, run

vim --version

you should see there +X11, +clipboard, +xterm_clipboard. I have st on dwm with arch too.

Upvotes: 0

filbranden
filbranden

Reputation: 8898

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.

Upvotes: 2

Related Questions