4

I am using Vim 7.4 homebrew version on Mavericks, with +clipboard. Under both vim and MacVim, yanking into either + or * has no effect and pasting from either one produces an error E353: Nothing in register * (or +).

Steps to produce it:

  1. $ vim -u None
  2. Insert some text
  3. "*yy
  4. "*p => E353: Nothing in register *
  5. :echo has("clipboard") => 1

This also means that both set clipboard=unnamed and set clipboard=unnamedplus cannot properly copy & paste. Can anyone suggest how I can troubleshoot this problem?

Thanks!

Related questions:

Community
  • 1
  • 1
koo
  • 2,888
  • 1
  • 23
  • 29
  • are you SSH'd to the machine running vim ? – exussum Dec 24 '13 at 12:41
  • @user1281385 No, I tried using vim directly, tmux+vim, and MacVim. – koo Dec 24 '13 at 13:54
  • @user1281385 I'm not sure if there's a good gvim port for Mac. – koo Dec 24 '13 at 14:01
  • I suspect this may be a recent regression in vim for Mac OS X? Because the brewed custom MacVim uses the same version with the same patches. – koo Dec 24 '13 at 14:07
  • 6
    Do you use tmux? tmux seems to have broken pasteboard and MacVim started from inside tmux cannot access the pasteboard. Refer to: http://stackoverflow.com/questions/16618992/cant-paste-into-macvim, https://hynek.me/articles/macvim-and-the-clipboard/ – Lie Ryan Dec 24 '13 at 17:11
  • 1
    You should make that into an answer, Lie Ryan. – echristopherson Dec 25 '13 at 02:33
  • @LieRyan You are right. The solution to this is to install `reattach-to-user-namespace` from homebrew and start MacVim with `$ reattach-to-user-namespace mvim`. Thank you! – koo Dec 25 '13 at 03:03
  • 1
    By default my tmux config tries to launch `zsh` with `reattach-to-user-namespace zsh -l`, but on my new system `reattach-to-user-namespace` is not yet installed and caused my confusion. – koo Dec 25 '13 at 03:07

3 Answers3

0

As I said in answer to the related question you cite:

1) Install parcellite (a clipboard manager with a low memory footprint).

2) In your .vimrc file, add the following:

command Clip r !parcellite -c

3) Restart vim.

Now when you type in :Clip as an ex command, the contents of the clipboard will be pasted in at the cursor. You can then map the new command to a function key so as to be able to do this with one keystroke.

lovecraftian
  • 71
  • 1
  • 4
0

I don't know if it works for Mac, but for my Debian machine it worked pretty well: https://superuser.com/a/482597

Just installing the package vim-gtk turned vim able to handle the clipboard.

Community
  • 1
  • 1
boechat107
  • 1,654
  • 14
  • 24
0

Do you use tmux? tmux seems to have broken pasteboard and MacVim started from inside tmux cannot access the pasteboard. Refer to: stackoverflow.com/questions/16618992/cant-paste-into-macvim, hynek.me/articles/macvim-and-the-clipboard – Lie Ryan

You are right. The solution to this is to install reattach-to-user-namespace from homebrew and start MacVim with $ reattach-to-user-namespace mvim. Thank you! – koo

By default my tmux config tries to launch zsh with reattach-to-user-namespace zsh -l, but on my new system reattach-to-user-namespace is not yet installed and caused my confusion. – koo

Community
  • 1
  • 1
Armali
  • 18,255
  • 14
  • 57
  • 171