brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: A in tmux copy mode adds a selection to what you already copied

Tmux
~/tips/tip-tmux-copy-mode-append

Ctrl-b [

Collects text from several places into one paste buffer.

Copying three lines from three places in the scrollback normally means three copies and three pastes. With A you can gather them into one buffer.

Ctrl-b [
Space  (start a selection, move, then)
Enter  (copy the first part)
Ctrl-b [
Space  (select the next part)
A

A runs append-selection-and-cancel. Instead of making a new paste buffer, it adds the selection to the end of the newest one and leaves copy mode. Do it as often as you need, then paste the lot with Ctrl-b ].

This is a vi mode key, so it needs set -g mode-keys vi. In emacs mode the command exists too, just without a default key, so you would bind it yourself:

bind -T copy-mode M-a send -X append-selection-and-cancel

I find it handy for building a short note from a long log: an error line, the timestamp above it, and the command that caused it.

The pieces are glued together exactly as selected, with no separator. If you want each on its own line, select to the end of the line so the newline comes along. And if you set copy-command for the system clipboard, note that appending only changes the tmux buffer.

Further reading: tmux manual page (OpenBSD)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server tmux new -s scratch \; set destroy-unattached on All Tmux tips (125) All topics

Link