Last Updated: September 09, 2019
·
6.154K
· sheerun

Gain clipboard support for Vim on OS X

Just:

brew update
brew install vim

Restart terminal, and ensure you have +clipboard in output of:

vim --version | grep clipboard

Then use + register to copy and paste code.

Bonus: read this tooltip by Jan about pasting from any register in Vim

Bonus 2: Make the system clipboard default register for yank.

4 Responses
Add your response

Did the update, it did not enabled clipboard when issuing 'brew install vim'.

Perhaps an option to configure ?

over 1 year ago ·

@niloct It did for me. Ensure which vim is returning the correct binary.

over 1 year ago ·

I had to alter the Formula for brewing vim:

system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
                      "--mandir=#{man}",
                      "--enable-gui=no",
                      "--without-x",
                      "--disable-nls",
                      "--enable-multibyte",
                      "--enable-clipboard",
                      "--with-tlib=ncurses",
                      "--enable-cscope",
                      "--with-features=huge",
                      *language_opts
system "make"

Notice the line which enables clipboard. After that brew was successful with +clipboard

over 1 year ago ·

Keep in mind if you use brew edit vim you'll also need to use brew install -s vim in order to build from source (possibly after a brew uninstall vim to get rid of the bottle, otherwise you ALWAYS get the bottled version which does NOT have +clipboard.

over 1 year ago ·