Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I paste to console Vim from the system clipboard?

I can copy text from Vim to other Mac applications with "*y. But when I try to paste into Vim, from TextEdit for example, I cannot paste text with "*p. Is there some setting that I missed?

like image 730
Kit Avatar asked Jan 13 '23 15:01

Kit


1 Answers

"*p and "*y don't work in the default Vim shipped with OS X simply because it was not compiled with clipboard support.

You may be led to believe that they work, somehow, because Vim won't complain if you use a non-existing register and yank in or put from the default register instead. :reg + and :reg * should show no content at all.

It's easy to verify if your Vim comes with clipboard support. The following command

$ /path/to/vim --version | grep clipboard

should find -clipboard and -xterm-clipboard which mean "no clipboard support".

The only practical way to have clipboard support is to install a proper Vim build, either by downloading MacVim, by using a package manager like Homebrew or Macports or by compiling it manually. I'd suggest the first option: it's the least geeky but the simplest and fastest.

like image 67
romainl Avatar answered Jan 22 '23 14:01

romainl