Search code examples
vimvitmux

How to copy and paste between different tmux panes running vim instances


Example: copy in one tmux pane (via vim), then switch to another pane (running another vim instance) and paste using the vim paste command. I know this can be done via tmux (using prefix+]) but it would be really handy if I can copy and paste using vim bindings since i'm just switching between different panes running vim.

Any ideas?


Solution

  • Sorry, I'm trying to convince you to use vim built-in features.


    To make the copy/paste easy, you can open files in another Tabpages:

    :tabe /path/to/another/file
    

    Use gt or gT to switch Tabpages.


    Or split the window to edit another file:

    :sp /path/to/another/file
    

    Use Ctrl-ww to switch Windows.
    To split the window vertically, please use :vsp file


    Update:

    This is my .tmux.conf file:

    # vim
    setw -g mode-keys vi
    bind [ copy-mode
    bind -t vi-copy v begin-selection
    bind -t vi-copy y copy-selection
    bind -t vi-copy V rectangle-toggle
    bind ] paste-buffer
    
    # buffer
    bind Space choose-buffer
    

    I only use them when I need to copy terminal output.