Skip to content

Instantly share code, notes, and snippets.

@armw4
Last active October 8, 2016 13:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armw4/8971667 to your computer and use it in GitHub Desktop.
Save armw4/8971667 to your computer and use it in GitHub Desktop.
Yank not working in Vim/MacVim.

by Antwan Wimberly

I recently encountered issues with yanking text in Vim. Yup, you know it, the infamous

***E353: Nothing in register ****

Only problem was, I wasn't sure if the issue was MacVim or spf13. Before logging an issue in either project, I decided to do a little research in hopes that someone had encountered a similar problem in the past. Luckily I can across this article by googling

macvim cant yank text

My query could be better, I know, but at least it yielded a helpful result (4th one down at the time of this writing). Like many other open source guys, I use Vim in conjunction with Tmux. The first thing I type after launching my shell is:

tmux new -s <sessionname>

Then I launch an instance of Vim or MacVim. If you've used Tmux even occasionally, you're aware that it has issues when interfacing with OS X's clipboard.

I of course have reattach-to-user-namespace installed on my system via Homebrew, so I assumed all my clipboard problems had gone away. Appears these pesky little boogers managed to make a comeback. For a while, I've been getting a message from reattach-to-user-namespace notifying me that it doesn't fully support OS X Mavericks. Nonetheless, things seemed to work normally and I could still copy/paste inside a Tmux session.

Long story short, I eventually came across this guy and this guy.

"Sidebar your honor...I had no idea that the use of Tmux and reattach-to-user-namespace caused zsh to be launched twice. Good to know that moving forward for troubleshooting purposes (not terribly thrilled about it of course). I digress. Anyway, seems like using reattach-to-user-namespace to launch Vim is the way to go. Guess I'll set up an alias like my man here."

If anyone comes across a cleaner solution, do let me know. I think I'll stick with this approach in the meantime, but "boy oh boy"...all this hoopla just to get one of the most basic and heavily relied upon features of your OS to work....simple copy/paste.

Shame on Apple once more...

@armw4
Copy link
Author

armw4 commented Feb 13, 2014

Wow, I'm also currently experiencing this issue outside of Tmux. MacVim won't allow me to access my clipboard all of a sudden. This didn't seem to occur until I reinstalled MacVim so it could link itself against the latest version of python (new homebrew package was recently published).

So am now launching MacVim via:

reattach-to-user-namespace mvim

and pasting, yanking text, clipboard, etc. seem to work fine.

@zx1986
Copy link

zx1986 commented Oct 8, 2016

I got this error too (inside tmux)
:-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment