Clipboard failure in tmux + vim after upgrading to MacOS Sierra

∥☆過路亽.° 提交于 2019-12-02 17:00:58

This seem to be a regression on macOS Sierra. A solution that worked for me has been mentioned by Josh McGinnis https://github.com/tmux/tmux/issues/543:

brew install reattach-to-user-namespace

Ensure the following is set in .tmux.conf:

set -g default-shell $SHELL 
set -g default-command "reattach-to-user-namespace -l ${SHELL}"

In .vimrc or ~/.config/nvim/init.vim (for Neovim):

set clipboard=unnamed

Now all is well and I can copy/paste between system <-> vim sessions using vim keybindings and/or system ctrl+c / ctrl+p.

Upgrading brew + vim + tmux fixed this for me:

brew update
brew upgrade vim
brew upgrade tmux

Notes:

  • I am not using Neovim but hopefully this will help anyway
  • This may take a while depending on how slow your machine is
  • When I did this brew upgraded ruby for me and it complained that it wouldn't overwrite the existing symlinks so I had to manually run: brew link --overwrite ruby
  • Tmux complained about the following setting after the upgrade. I just commented it out: # set-option -g status-utf8 on
  • I had a warning about needing the new xcode tools so I ran the following and accepted the GUI prompts: xcode-select --install (In hindsight this may mess up my react-native install :/. Buyer beware)
  • When first running brew update brew complained it didn't have write access to /usr/local so I made myself the owner of /usr/local NON-RECURSIVE. After the update brew told me I could change the owner back to root:wheel.

I saw the same upon upgrading to Sierra. In my case it stemmed from having the YankRing plugin installed.

Adding the following to my .vimrc fixed it for me:

"-------------------------------------------------------------
" Fix for YankRing bug
"-------------------------------------------------------------
let g:yankring_clipboard_monitor=0
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!