Fix Vim + Tmux yank/paste on unnamed register

前端 未结 5 863
北海茫月
北海茫月 2020-12-22 17:59

While using vim inside a tmux session I cannot yank or paste to the unnamed register. Going to a named register works fine, but unnamed never works.

Error is:

<
5条回答
  •  被撕碎了的回忆
    2020-12-22 18:22

    The fakeclip plugin makes the clipboard register behave as expected in many terminals and has support for tmux/screen. Are you using it? It may resolve your issue.

    As well, you may be interested in this tip... It's not applicable to your question, but related. Depending on what type of system/terminal you're running tmux in, you may need some tweaks in your .tmux.conf. For example here's an excerpt of my .tmux.conf on OS X (with some instructions in comments):

    # To use pbcopy and pbpaste on OS X, get this wrapper and install
    #    git clone https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git
    #    cd tmux-MacOSX-pasteboard/
    #    make reattach-to-user-namespace
    #    mv reattach-to-user-namespace /usr/local/bin
    # After installing, the default command can be reset to use the 'reattach-to-user-namespace' 
    # wrapper that was compiled/installed as descripted above.
    set -g default-command "reattach-to-user-namespace -l /bin/bash"
    # #Next, create Ctrl-c and Ctrl-v mappings
    bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
    bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
    

提交回复
热议问题