2016-09-22 75 views
37

昨天,我升級到MacOS Sierra,並在我的tmux + neovim設置中破壞了我的剪貼板功能。升級到MacOS後,tmux + vim中的剪貼板故障Sierra

這裏是行爲:

  • 我可以使用標準的CTRL + C,CTRL + P複製/系統之間的膏< - > VIM
  • 我可以拷貝兩個VIM實例時間/粘貼不是在TMUX會議
  • 我不能把抽出/粘貼2個VIM實例之間時,在TMUX會議

每當我使用剪貼板在VIM一TMUX會話中,我得到以下錯誤的vim :

clipboard: error: 

.vimrc是巨大的,但這裏是我認爲可能是相關的:

set clipboard=unnamed 

在我.tmux.conf(也被截斷爲簡潔起見):

set -g prefix `         # use tilde key as prefix 
bind ` send-key `         # insert tilde by pressing twice 

set -g history-limit 100000      # set buffer size 
set -s escape-time 0        # fix escape key in vim 
set -g allow-rename off       # keep window names static 
set -g default-terminal "screen-256color"   # set the TERM to 256 colors 
set -g base-index 1        # start window count at 1 
set -g pane-base-index 1       # start pane count at 1 
set -g default-shell $SHELL      # use zsh as shell 

編輯:這似乎與此處報告的錯誤有關:

https://github.com/tmux/tmux/issues/543

https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/53

+0

Neovim or Vim? – romainl

+0

@romainl兩者,只要它們在tmux會話中運行即可。請參閱第二期問題鏈接中提到的回購。似乎是每個新MacOS版本引入的經常性迴歸。 – doremi

回答

57

這似乎是在MacOS塞拉利昂迴歸。爲我工作一個解決方案已經提及Josh McGinnishttps://github.com/tmux/tmux/issues/543

brew install reattach-to-user-namespace

確保以下設置在.tmux.conf:

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

在.vimrc或〜/的.config/nvim /init.vim(用於Neovim):

set clipboard=unnamed 

現在一切都很好,我可以在系統之間複製/粘貼< - > vim的會議我們ing vim keybindings和/或系統ctrl + c/ctrl + p。

+0

謝謝!對於可能發生的這類小事,我暫時停止升級。那麼,蘋果最後一次讓我惱火,我升級了...... DOH! – eduncan911

+1

謝謝你,爲我工作。 我使用「*」寄存器複製到剪貼板,所以我跳過了'set clipboard = unnamed'行。 – equivalentideas

+1

這項工作。但是,每個打開的新tmux窗格都被命名爲'reattach-to-user-namespace'。這是預期的嗎? –

1

我看到了同樣的在升級至塞拉利昂。在我的情況下,它源於安裝了YankRing插件。

添加以下到我的.vimrc固定對我來說:

"------------------------------------------------------------- 
" Fix for YankRing bug 
"------------------------------------------------------------- 
let g:yankring_clipboard_monitor=0 
8

升級沖泡+ VIM + TMUX固定這對我來說:

brew update 
brew upgrade vim 
brew upgrade tmux 

注:

  • 我不使用Neovim但希望這將有助於反正
  • 這可能需要一而根據你的機器的速度有多慢
  • 當我做了這個brew升級紅寶石給我,它抱怨說它不會覆蓋現有的符號鏈接,因此我必須手動運行:brew link --overwrite ruby
  • Tmux在升級後抱怨以下設置。我只是評論一下:# set-option -g status-utf8 on
  • 我有一個警告有關需要新的Xcode工具,所以我跑了以下,並接受了GUI提示:xcode-select --install(事後看來這可能弄亂我的react-native安裝:/買家當心)
  • 第一次運行brew update brew時抱怨說它沒有對/usr/local的寫入訪問權限,所以我讓自己成爲/usr/local的所有者非RECURSIVE。更新brew後告訴我,我可以將主人更換回root:wheel
+0

還值得注意的是,你需要使用以下命令重啓tmux服務器:'tmux kill server' –

+0

這對我有用! tmux和Iterm2的 – Agis

+0

我需要獲得一個測試版才能正常工作(轉到iterm2首選項|常規並在服務部分選擇'提示測試版本'。 – diabolist

相關問題