Claus-Theodor Riegg
6 years
Andreas Vöst
1 year

HowTo: Easier selecting and copying of text in tmux

Posted . Visible to the public.

When using tmux, selecting and copying multiple lines of text can be a hassle, especially when using splits (highlighting lines will cross pane borders, copying contents from the other pane too) and when the user wishes to copy (thus, select) lines that have already scrolled out of the viewport in the current pane.

One idea would be to enable mouse mode in tmux, which makes the selection tmux aware. However, this will no longer populate the selection clipboard of the graphical environment, limiting copying and pasting to the same tmux instance. Fortunately there's a plugin that makes tmux' clipboard sync to the graphical environment's selection clipboard: tmux-yank Show archive.org snapshot

When using the tmux plugin manager Show archive.org snapshot , the solution is easy, in our .tmux.conf:

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g mouse on

the plugin can also be installed manually by cloning the repository Show archive.org snapshot .

Emma Heinle
Last edit
Emma Heinle
License
Source code in this card is licensed under the MIT License.