I use vim to develop Perl code on a remote Linux box running Debian Jesse. The machine is a virtual machine running in VirtualBox. I use ssh and then issue a vim <file> command to start editing the file.

I've been experimenting with tmux on the remote machine to see how I like it. But I cannot for the life of me figure out how to copy and paste text between vim instances in two different tmux panes. I'd prefer to be able to use both the mouse and vim-like keystrokes (yy, dd p) to do this.

I've tried just about every recommendation out there for trying to get this to work but I haven't gotten anywhere. I'm running El Capitan. Is there a definitive answer out there for getting this to work?


A better way to do it is save the selection in a temporary file and use tmux load-buffer command to load it into the paste buffer, and then C-b ] to paste.

Otherwise you may have problems with long text lines that don't fit into the screen. Also, tabs might not be preserved and long lines may be broken down.

I have to mention another (easier) way to do it without any additional files.

There's a mod for tmux adding more flexible scripting capabilities: http://ershov.github.io/tmux/ (I'm the author)

It allows you to copy and paste without using any temporary files:

  1. Copy selection in vim
  2. In vim, type :!tmux tcl pbcopy "^R%" this will put the vim's paste buffer into tmux's one
  3. In tmux, in another pane use ^B ] to paste.

You probably want to use :set paste in vim.

And if you do it frequently, you can automate the step 2 and bind it to a keypress in vim.


I have run into the same issue and my solution is to use tmux instead of vim in these instances.

  1. enter copy mode using Control+b[
  2. navigate to the beginning of the text, you want to select and hit Control+Space
  3. move around using arrow keys to select region
  4. when you reach the end of the region simply hit Alt+w to copy the region
  5. now Control+b ] will paste the selection

Your key bindings may vary slightly

got this from here: https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .