Copy to clipboard from Tmux in El Capitan
Solution 1:
Actually, I just find out very simple solution how to enable copying using Cmd+C again.
In default Terminal application go to View->"Allow mouse reporting" and uncheck it. Thats it.
PS: Obviously, the new nice features like dragging split screen in tmux stop working after unchecking the mouse reporting.
Solution 2:
If you use iTerm2 3.x, you can make copy / paste work by enabling Applications in terminal may access clipboard
:
Just highlight text with your mouse to copy it into the OS X clipboard!
You can also paste from the OS X clipboard into tmux with the usual Cmd + V.
Solution 3:
If you hold the function key down you can select and copy to clipboard with apple+c as well.
Solution 4:
Actually, i was wrong when stating that copy-pipe
does not work. It does, and copy-selection
is then superfluous, as copy-pipe
both copies text to Tmux pasteboard and pipes to an arbitrary shell command. So the following line works:
bind-key -t vi-copy 'y' copy-pipe "pbcopy"
However, one needs to press y
before releasing the mouse button. I've stumbled across this in the documentation for tmux-yank plugin:
"When making a selection using tmux mode-mouse on or mode-mouse copy-mode, you cannot rely on the default 'release mouse after selection to copy' behavior. Instead, press y before releasing mouse."
So it works, but with somewhat annoying need to press y
in order to copy mouse-selected text.
Solution 5:
Using tmux version 2.2 or later add the following to your tmux.conf file:
bind-key -t emacs-copy MouseDragEnd1Pane copy-pipe "pbcopy"
bind-key -t vi-copy MouseDragEnd1Pane copy-pipe "pbcopy"