I'm unable to use the system clipboard in Vim. I'm using ssh to connect to an EC2 instance running Ubuntu 18.04. I'm fairly sure that this has to do with neither the * or the + register showing up in the output of :reg.

Here's what I mean: reg output missing * and +

I've tried vim-gtk, vim-gtk3, and vim-gnome and the output of :reg is always missing + and * registers.

However, in Neovim, the + and * registers show up and I am able to use the system clipboard:

reg with + and * registers

How do I make the + and * registers appear (work) in regular vim?

  • Can you confirm if vim was compiled with clipboard features enabled (easiest to just enter ex command, :version, and look for +clipboard otherwise enter the ex command, :echo has('clipboard') May 8, 2019 at 21:10
  • Yup, all three version I've tried-- vim-gtk, vim-gtk3, & vim-gnome-- are compiled with both +clipboard and +xterm_clipboard.
    – Cat
    May 8, 2019 at 21:24
  • Vim uses X to handle the clipboard. You could try ssh -X <user>@<hostname>. Than you should be able to open X applications (I always test with xclock). If that works, Vim also should have access to your local system clipboard.
    – Ralf
    May 9, 2019 at 5:11
  • I should have specified that I'm trying to get Vim to copy to the server's clipboard. I'm using Tmux and I want to be able to y from one Vim window and p it into the next. This already works perfectly on my local computer: imgur.com/a/cEsRiEO
    – Cat
    May 9, 2019 at 6:09
  • Hi Cat, can you execute this setting check ex command, :set nocompatible? May 9, 2019 at 19:35

2 Answers 2


I found the answer:

Clipboards in linux are handled by the X server. Because I am using an AWS EC2 instance without the X server installed, there is no such thing as a "system clipboard" in Vim and therefore the * or + registers are missing.

I installed Xvfb, which is a sort of dummy X server that is able to maintain a system clipboard, and ran it using xvfb :0.0. Then I set my display variable: export DISPLAY=:0.0. Now the * register shows up in vim :reg and I am able to copy things from one Vim instance to another.

I made a script to automate this process of getting the system clipboard to work in Vim. The script installs Xvfb, creates a xvfb.service file and uses it to enable xvfb starting on boot, and adds export DISPLAY=:0.0 to your bashrc so you don't have to set it each time you want this to work. To run the script, do: sudo bash install_vim_system_clipboard.sh.


Installing gvim solves the issue in vim.

Once you install gvim, you will find the + and * registers working in vim.

I was told it has to do with the way the 'vim' package is usually compiled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.