Vim "yank" does not seem to work

Adam Rubin picture Adam Rubin · Jul 10, 2013 · Viewed 16.8k times · Source

I'm fairly new to Vim. Tonight, I learned about the "yank" command, but when I try to use it in MacVim, it doesn't do anything. Neither Y nor y{motion} do anything. I tried with a default .vimrc to rule out any weird config issues.

Google-fu is failing me. This feels like a noobie issue. Am I missing something obvious?

Answer

Weston Ganger picture Weston Ganger · Sep 4, 2016

If you have the setting set clipboard=unnamedplus in your .vimrc then this will not be working.

For OSX you have to use set clipboard=unnamed

For Linux you will probably need to use set clipboard=unnamedplus

Heres the snippet from my personal .vimrc

if system('uname -s') == "Darwin\n"
  set clipboard=unnamed "OSX
else
  set clipboard=unnamedplus "Linux
endif