tmux - cllu/.rc GitHub Wiki

Tmux attach: no seesions

Sometimes tmux refuses to connect to the session even the tmux server is still running. This is due to the lost of socket. To force tmux recreate socket, send SIGUSR1 signal to tmux.

killall -s SIGUSR1 tmux

Copy mode

By default, Ctrl+B and then [ will enter copy mode. Then you can start the selection by pressing Space, and end the selection by pressing Enter. Most of the vi commands work in copy mode, such as search command / and ?, or movement Ctrl+F and Ctrl+B. However, to better integrate with vim, we can set up selection using v and y:

bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

After you have copy the text, you can paste them using Ctrl+B and then ]. There are various other ways to use the copyed text

$ tmux show-buffer # show the current selection
$ tmux list-buffer # show all the available paste buffer, or you can use `Ctrl+B` and `#`
$ tmux save-buffer file.txt # save current selection to file
$ tmux save-buffer -b 1 file.txt # save the buffer numbered 1 to file