Introduction

Vim's + and * registers allow copying and pasting with the system clipboard. When Vim is compiled without clipboard support or the terminal environment is not configured correctly, these registers are unavailable:

vim
:reg +
" Returns empty or shows an error
E353: Nothing in register +

This means "+y (yank to system clipboard) and "+p (paste from system clipboard) do not work, breaking the workflow between Vim and other applications.

Symptoms

  • "+y and "+p do not copy/paste to the system clipboard
  • :echo has('clipboard') returns 0
  • vim --version shows -clipboard (minus sign means disabled)
  • :set clipboard=unnamedplus has no effect
  • Works in GVim but not in terminal Vim

Common Causes

  • Vim compiled without +clipboard support (common with minimal vim packages)
  • Missing clipboard utility (xclip, xsel, or wl-clipboard for Wayland)
  • SSH session without X11 forwarding
  • Terminal emulator does not support clipboard integration
  • Wayland session using different clipboard protocol than X11

Step-by-Step Fix

  1. 1.Check if Vim has clipboard support:
  2. 2.```bash
  3. 3.vim --version | grep clipboard
  4. 4.`
  5. 5.Look for +clipboard (plus sign means enabled). If you see -clipboard, you need a different Vim build.
  6. 6.Install a Vim package with clipboard support:
  7. 7.```bash
  8. 8.# Ubuntu/Debian
  9. 9.sudo apt install vim-gtk3

# Fedora sudo dnf install vim-X11

# macOS (Homebrew) brew install vim ```

  1. 1.Install clipboard utilities:
  2. 2.```bash
  3. 3.# For X11
  4. 4.sudo apt install xclip xsel

# For Wayland sudo apt install wl-clipboard ```

  1. 1.Configure clipboard in vimrc:
  2. 2.```vim
  3. 3." Use + register for all yank/delete/paste operations
  4. 4.set clipboard=unnamedplus

" Or for macOS (uses pbcopy/pbpaste) set clipboard=unnamed ```

  1. 1.For SSH sessions, enable OSC 52 clipboard support in your terminal. Add to .vimrc:
  2. 2.```vim
  3. 3.if !has('clipboard') && &term =~# 'xterm|screen|tmux'
  4. 4." Use OSC 52 escape sequence for clipboard
  5. 5.let g:osc52_clipboard = 1
  6. 6.function! CopyToClipboard(text)
  7. 7.call system('printf "\033]52;c;" . a:text . "\007"')
  8. 8.endfunction
  9. 9.endif
  10. 10.`
  11. 11.For tmux, enable clipboard passthrough in ~/.tmux.conf:
  12. 12.`
  13. 13.set -g set-clipboard on
  14. 14.set -s set-clipboard on
  15. 15.`

Prevention

  • Always install the full-featured Vim package (vim-gtk3, vim-X11) not the minimal one
  • Check has('clipboard') in your vimrc and show a warning if it is missing
  • Document the required system dependencies for clipboard support in your setup guide
  • Use tmux with set-clipboard on for remote editing sessions
  • For headless servers, use OSC 52-compatible terminal emulators (iTerm2, Kitty, Alacritty)
  • Test clipboard functionality after installing Vim on a new system: echo "test" | vim -es -u NONE "+set clipboard=unnamedplus" "+normal gg\"+y" +q
  • Consider using a terminal multiplexer (tmux/screen) with clipboard integration for remote work