tmux copy and paste

Since I always need to search for it, if I need it and not just for scrolling: One must be in the vi-mode (<prefix> : and then set mode-key vi)

  • [ # start copy mode
  • Navigate to start of the block to be copied
  • # begin selection
  • # end selection/copy
  • ] # paste

Or if one is in the emacs mode and does not have vi in the EDITOR or VIEWER system variable the inner secquence would be

  • + # begin selection
  • + g # end selection/copy

Configuration change

With the following config one can use a more vim like copying

set -g mode-keys vi
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
  • [ # start copy mode
  • Navigate to start of the block to be copied
  • v # begin selection
  • y # end selection/copy
  • p # paste

and if one also wants to go into the copy mode without [, but with ESC one should add

bind Escape copy-mode

to the .tmux.conf

Further reading

Arch Wiki on tmux and a question similar to mine at superuser. And to give some further reedings: A good Cheet cheet on github.