Using mouse to select text with tmux sometimes is inefficient. For my setup, I’ll have to press shift key during text selection and keyboard copy will convert empty line as spaces. The following 2 lines in the configuration file works with version 2.8 (latest at the time of writing).
As I am using Linux, the command line clipboard program is xclip
. For mac users you need to use pbcopy
.
Add those lines to your ~/.tmux.conf
bind-key -Tcopy-mode-vi 'v' send -X begin-selection bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -i -sel c"
Now when you are on the select mode (prefix+[
), hit v or space to start selecting. After, press y to yank lines to clipboard. You can paste it anywhere else.
For mac, switch to pbcopy instead of xclip. Or in general you can use clipcopy (oh-my-zsh built-in function)