Manual page
What man tmux-companion shows, rendered from docs/tmux-companion.1.
| TMUX-COMPANION(1) | General Commands Manual | TMUX-COMPANION(1) |
tmux-companion — a
status line, a set of pickers and a project manager for tmux
SYNOPSIS
Section titled “SYNOPSIS”tmux-companion |
command [flags] |
DESCRIPTION
Section titled “DESCRIPTION”tmux-companion is one binary in two
modes.
server binds a unix socket and answers
requests forever, holding the caches that make a status line cheap. Every
other command is a client: it connects, starting the server when the socket
is absent, writes one JSON line, reads one back, prints it and exits.
The point of the split is the status bar. tmux gates
‘#()’ to
status-interval per attached client, and a spawn
costs 12.4 ms of CPU before the command has computed anything, so the bill
is the number of distinct commands rather than what they do.
status-right answers with git, bandwidth and battery
in one call.
Commands that draw on a terminal -- the pickers, the dialogs -- run in the client process. The daemon has no terminal; it answers with rows and the client draws them.
Daemon lifetime
Section titled “Daemon lifetime”One daemon answers for one socket. A start takes an exclusive lock on <socket>.lock before it touches the socket file, and a start that cannot take the lock exits quietly, leaving the daemon that holds it to answer. Without the lock two starts in the same moment both unlink the socket file and both bind, and the one whose file was taken away keeps running where no client can reach it.
A daemon exits when the socket file it bound is deleted or
replaced, which it checks every thirty seconds. That is the only thing that
ends a daemon besides a signal or __shutdown, and it
is what stops an abandoned daemon from outliving the socket it was started
for. The next client starts a fresh one, which costs one cold
git(1) status.
__shutdown removes the socket file on its
way out, so a path with no socket file means no daemon rather than a daemon
that has stopped answering.
GETTING IN
Section titled “GETTING IN”start[directory] [--last,--hook]- The way in, from a shell that is not in tmux yet. Opens the project
picker, live sessions first and every directory the configured source
knows underneath, and attaches to what is chosen. The source is
zoxide(1) unless
[project] dirs_sourcesays otherwise.--lastgoes back to the session used most recently without asking, and a directory skips the picker. Inside tmux it switches rather than attaching.‘
tmux’ on its own leaves you in a session called ‘0’ holding one bare shell, which is what this replaces.--hookis for theclient-attachedhook in tmux.conf, so that plain ‘tmux’ lands in the same picker: it opens only when the session is one tmux named itself, all digits, with one window, one pane and a shell in it, and leaves any other session alone. clickrange- What a mouse click on a segment of the right side does. The
agentsandhealthsegments carry a ‘range=user|NAME’ mark, the way tmux marks its own window list, so a ‘MouseDown1StatusRight’ binding of ‘run-shell tmux-companion click '#{mouse_status_range}'’ reaches this with the segment's name; it runs what[[status.right.segments]] on_clicksays for that segment, or the default: the inbox for the agent count, the brief for the health mark, nothing for the rest. brief[--print,--hook]- What needs you, on one screen: the agents waiting and what each one asked,
the reasons the health mark is up, the sessions nobody has touched for
three days, how long a sitting has run when the chunk clock is on, quiet
hours when they are on, and one line of numbers with when the last
snapshot was. Everything on it is a command of its own; this is the one
look on sitting down, and somewhere to act from.
In a terminal it waits for keys, and a footer names the ones that do something right now:
- number
- go to that waiting agent's pane, or to that idle session; the numbers run on from the agents into the idle sessions, and with ten rows or more a digit that could start a longer number waits for the next digit or enter
cnumber- close that idle session, asking first, its layout saved, as
sessions idledoes h- acknowledge the health reasons, as
health ackdoes d- show the
doctorreport, and come back on enter i- open the
inboxpicker j- open today's
journalpicker s- save a snapshot, as
sessions savedoes z- an hour of quiet, or with quiet on, the end of it
q,Esc,Enter- close
Going somewhere, and
iandj, end the brief. The rest say one line about what they did and draw the brief again.--printprints and exits, with no numbers and no keys.--hookis for theclient-attachedhook: it opens the popup only when something is waiting or wrong, and says nothing when the server is quiet. In the week after a build first runs, a line counts thesetupitems still open, when there are any. setup[--print]- Lists what the tool offers and the state of each:
‘
on’, ‘open’, ‘off-by-choice’, ‘skipped’ or ‘cant-tell’. Enter copies the lines to the clipboard and asks before adding them to tmux.conf or config.toml. Ctrl-x skips a row. Ctrl-e sets a binding's key.--printprints id, group, state, key and line, tab-separated.
STATUS LINE COMMANDS
Section titled “STATUS LINE COMMANDS”These print tmux format strings on standard output and are meant
for ‘#()’ in
tmux.conf.
status-right[path] [--stylestyle,--branch-max-lenn]- Git, bandwidth and battery in one call, computed concurrently, and the
agent count and the health mark when
[status.right]asks for them. The health mark is one glyph and a word when a timer failed in the last hour and hasn't worked since, config.toml changed after the daemon started, or the binary on disk is newer than the daemon running; nothing when the daemon is fine. With[online] enabledit also reads ‘offline’ when two TCP connections in a row to[online] probewent unanswered,[online] interval_secsapart; it is off until turned on, since the probe reaches an address outside the machine. One ‘#()’ rather than three. Theagentssegment reads ‘4 agents • 1 waiting’: how many panes run one of[agents] programs, and how many of those have drawn nothing for[agents] waiting_secs.[agents] styleset to ‘glyphs’ draws the robot and the count, then an arrow, an hourglass and the waiting count, with nothing spelled out.[agents] showpicks the count after the total: ‘waiting’, the agents that have stopped, whether a hook saidaskedordone, the bell rang, or the window went quiet; ‘busy’, the agents that are working, drawn with the progress glyph, for somebody who keeps a dozen open and works one at a time; or ‘both’. It draws nothing when no agent is running, and the pane list behind it is read at most once per[agents] interval_secshowever many clients are attached, and never when the segment is not configured. Takes a path and deliberately no pane pid: a pid makes the git segment enumerate every process on the machine, which cost 18.5 ms of its 26.0.--styleis one of ‘fill’, ‘outline’ or ‘outline-bright’, and anything else is refused with that list.--branch-max-lenmiddle-ellipsizes a branch name longer than n; without the flag[git] branch_max_lendecides, 20 out of the box. gst[path] [pid] [--no-daemon--no-tmux]- The git segment on its own: branch, what is dirty, ahead and behind, with
the same
--styleand--branch-max-len. With a pid it also marks a suspended editor. A daemon that answers with an error exits this command non-zero, which tmux ignores in a ‘#()’ and a prompt or a script can read. battery- Charge, as an icon and a percentage. Reads the platform's battery and prints nothing on a machine without one.
net[--no-daemon--no-tmux]- Bytes per second in and out, over all interfaces but the loopback. A rate,
so it is never cached. Draws nothing below
[network] threshold_bps. sh-jobspane-pid- What is stopped or running under a pane, from the table in
[[sh_jobs.job]]. clientsattached active- A marker when more than one client is looking at this session.
window-iindex [flags]- One window's entry for
window-status-format. Costs a process spawn per window per redraw, and tmux redraws on pane output as well as on the timer, so this is the expensive way to draw a window list. preview- Sample git segments in every colour style, without a server.
Outside tmux
Section titled “Outside tmux”gst and net are
ordinary commands that print a string, and neither needs tmux to be running.
Two flags make them usable anywhere a shell prompt, a bar or a script wants
them.
--no-tmux- Write ANSI escapes instead of tmux's
‘
#[fg=...]’ markup, and reset the terminal at the end so nothing after the segment inherits its colour. A segment that drew nothing prints nothing, not even a newline. --no-daemon- Compute the answer in this process and exit. No socket is opened, no
server is started and nothing is left running. The cost is the cache:
every call pays for a cold git(1) status, about 51 ms
against a large tree, where the daemon answers a warm one in well under a
millisecond. That is the right trade for a shell prompt and the wrong one
for a status bar refreshing once a second.
netis a rate and needs two counter readings, so without a daemon to hold the first one it is kept in $XDG_STATE_HOME/tmux-companion/net-sample. The first call after a reboot records the reading and draws nothing, which is what the daemon does on its first call and for the same reason.
For a prompt, in bash(1) or zsh(1):
PS1='$(tmux-companion gst --no-daemon --no-tmux) $ '
Inside tmux, leave both flags off: the daemon is what makes the segment cost almost nothing to draw once a second.
PICKERS
Section titled “PICKERS”Each is a fuzzy-matched list with a preview. They are bound to keys in docs/tmux.conf.full.example; the bindings shown are that file's.
Every picker takes the same keys. Typing filters, the arrows and
Page Up and Page Down move, enter takes the row, and escape, ctrl-c or
ctrl-d closes it. Ctrl-a, ctrl-u or Delete clears the filter, ctrl-p or Tab
steps the preview through its sizes, so the list beside it widens and
narrows and the last step hides the preview, ctrl-j and ctrl-k scroll it,
and alt-enter takes what was typed rather than the row. A picker with a
preview says Tab and ctrl-j/k in its line of keys, unless the line is your
own from hint in the config. The terminal's cursor
sits on the selected row, which is what a screen reader or a braille display
follows, and on the end of the filter when nothing is listed. Nothing in a
picker is timed unless asked for: the window switcher commits on a pause
only with [switcher] commit
= "pause".
project[directory [--detached]] [--print]- Live sessions and the directories the configured source knows, in one
list, each in its project's colour. The source is
zoxide(1) by default and
[project] dirs_sourcechanges it; a source that is not installed lists nothing rather than failing, and a directory it has never seen can still be typed in full. Picking a live session switches to it; picking a directory builds its session from[[layout]]. A live session nobody is attached to that has been quiet for a day or more carries an ‘idle’ column with its age, so the stale ones stand out without leaving the list;sessions idleis the one that closes them.--printlists the rows and exits, and opens nothing; it cannot be combined with a directory. Each row is kind, name, path, colour and host, tab-separated, the host empty for this machine and a host's path shortened against its home. A host's group line prints as ‘host’, its sessions as ‘session’ rows named ‘api@vm’, and its directories, inside one of its mirror sessions, as ‘dir’ rows named the same way; see OTHER HOSTS. With a directory,--detachedmakes its session and prints the session's name, switching and attaching nothing: what a mirror session's pane runs on its host before the attach. Bound to ‘M-s’. Sessions are listed most recently attached first, so the second row is the session you were in before this one, and ‘M-s’ in the picker switches to it at once: ‘M-s M-s’ goes back. It does nothing when there is no other session. project save[--no-commands]- Capture this session's windows and panes as the layout this project opens
with. A saved layout wins over the config. The save is all or nothing: if
tmux cannot be read, or answers with a line this cannot parse, nothing is
written and the layout already on disk is left alone, because a layout
quietly missing a pane is worse than one that is out of date. The file is
written through a temporary name and renamed over the old one, so a save
interrupted halfway leaves the previous layout rather than half of a new
one. Bound to ‘
prefix S’. project forget[directory]- Delete the saved layout, so the config decides again. The project is the
session this runs in, or the directory given. Bound to
‘
prefix M-S’. project show[directory]- Which layout this project gets, which file decided, and the windows it
opens. The order is a saved layout, then the checkout's own
.tmux-companion.toml, then
[[project.override]], then[project] layout. A saved file that is there and not used is named with the reason, whether it does not parse or an older build wrote it wrong, and so is a checkout file; a checkout file whose commands were blanked because the project is not under[project] trustedsays so. The project is the session this runs in, or the directory given.close-projectis the old name forproject closeand still works for one release. sessions save[--skip-pane-history] [--excludenames]- Capture every session on the server as a new generation under the state
directory. Where
project savekeeps one file per project, overwritten on demand and edited by hand, this keeps generations of the whole server and throws the oldest away: the first answers what a project looks like, the second what you were doing at the time. The save is all or nothing, like a project's: a line of tmux output this cannot read stops the write rather than shrinking the snapshot. A note left on a pane withnoteis captured with it and put back by a restore.--skip-pane-historyrecords the sessions and leaves out what was on each pane's screen, which is the expensive half and the half holding whatever you printed.--excludeadds to[sessions] excluderather than replacing it, and a session left out is one that does not come back. sessions export[file] [--stampstamp]- A generation as one file that reads on another machine: every path under
the home directory is spelled ‘
~’, the project colours from _project-map.tsv travel with it, and what was on each pane's screen is left behind. The newest generation unless--stampnames one; printed when no file is given. sessions importfile [--no-map]- The file
sessions exportwrote, stored here as a new generation with this machine's home in place of ‘~’, and the project colours it names added for the projects this machine has not coloured yet;--no-mapleaves the map alone. Thensessions resurrectbrings it up and says which directories are not here. The themes themselves come fromtheme init. sessions resurrect[stamp] [--onlynames] [--excludenames] [--merge] [--dry-run] [--yes] [--detach]- Rebuild a server from a generation, defaulting to the newest. With no
generation of its own to read, it reads tmux-resurrect's newest save
instead, so a machine with months of those loses none of them on the day
it switches over. A snapshot written by a newer build than this one is
read anyway, with one line on standard error saying the restore may miss
what that build knew. Refuses outright when the server already holds
sessions, naming them, because a restore that half-landed on work somebody
was doing is the failure worth being careful about.
--mergeadds the sessions that are missing and never touches one that is running.What each pane gets told to run comes from
[[restore.program]], which is default deny: a command no row claims opens the pane and says so rather than running it. So does a command the capture had to guess at, since its arguments are already gone and running it would bring an agent back in the wrong conversation.--dry-runprints the exact tmux commands and exits, and they are the commands that would run rather than a description of them. It prints the waits too, as comments, because a restore is not only tmux calls.When the restore does not know what a pane should run, and somebody is watching, it shows what it is about to do and counts down before going ahead. It opens for a pane no row claims, one a row refused, and one whose command the capture read off a running process so the arguments are already gone. It opens too when the daemon before this one crashed, once: a restore that goes ahead clears the crash, and a dry run or a cancel leaves it for the next. It never opens on a count of panes: a restore where everything is known goes straight through however many there are, because a confirmation on every restore is one people turn off. Any key stops the clock, ‘
tab’ runs one of the listed panes after all, ‘a’ takes all of them and ‘q’ cancels.[sessions] confirm_secssets the countdown and zero never draws it.[sessions] confirm_waitdraws it with no countdown and waits for a key, whateverconfirm_secssays.--yesruns everything the table claimed without asking; whatever is not run still opens its pane, in the right directory, at a prompt.Before a pane is told to run anything it has to have drawn a prompt, which tmux knows only when the shell tells it, which is what
shell-initmakes the shell do. A shell that emits the mark answers in milliseconds; one with noshell-initline in its rc file costs two seconds and is then typed into anyway, which is what a restore did before the marks existed.It attaches at the end when somebody is watching, which means stdin is a terminal and
TMUXis unset, so the same command in a boot script leaves the server running.--detachsays so explicitly. The exit codes are ‘0’ restored, ‘2’ bad arguments, ‘3’ refused because sessions are live, ‘4’ nothing to restore, and ‘1’ for anything else. sessions shutdown[--excludenames] [--daemon-too] [--dry-run]- Save every session, then stop the tmux server.
--excludeis not "leave these alone": stopping the server takes every session with it either way, so a session left out here is one that does not come back, and the command says which before it acts.--daemon-toostops the tmux-companion daemon as well. sessions restart[--excludenames] [--keep-daemon] [--dry-run]- The same, and then bring the server back with what it had. It stops the
daemon by default, which
--keep-daemonturns off. The default is that way round because config.toml is read once when the daemon starts and held for its whole life, so a restart that left it running would hand back a new binary, a freshly sourced tmux.conf, and yesterday's configuration.Both refuse to run from inside tmux, because stopping the server would take the pane they were typed into and nothing after that would run. There is no flag for it. Both say so on standard error, as they do when no tmux server is running, and a
sessions restartwith no server to restart points atsessions resurrectinstead. sessions autosave[--once] [--status]- The snapshot timer the daemon runs, which
[sessions] autosaveturns on.--oncetakes one now and--statussays when the last one happened, what the timer is set to, and whether the daemon before this one stopped cleanly. With neither flag it reports, the same as--status.That last answer comes from a file the daemon writes when it starts and removes when it stops cleanly; the next daemon to start finds one naming a pid that is no longer alive and sets it aside as crashed, which is what the answer reads, so a daemon that is alive right now never counts as a crash. The marker stays until a restore has gone ahead on it, or a later crash replaces it. A snapshot's own record cannot answer it: a capture taken on the timer says ‘
taken while running’ because the daemon does not know yet, and nothing goes back to correct the one that turned out to be the last before a crash. sessions list[--json]- Every generation, newest first, with how much each holds and whether the
daemon that wrote it went on to shut down cleanly. The newest carries a
‘
*’. A generation is stamped in UTC, so on a machine well away from it the stamp and the file's own modification time are hours apart and both are right. sessions show[stamp] [--json]- What one generation holds, down to each pane's directory and command,
defaulting to the newest. The command is marked with how sure the capture
was of it: ‘
Exact’ for what the pane was started with, ‘Guessed’ for what it happened to be running, and a shell for a pane sitting at a prompt. sessions renamenew [--sessionname]- Rename a session, the one this runs in unless
--sessionnames another, and its project colour with it. On a host, the grouped session each machine's mirror attached through becomes ‘new~machine’ in the same step, and each machine's mirror session follows on its own as ‘new@host’. Run inside such a grouped session, it renames the session the mirror stands for. Run on a mirror session here, it says to rename it on its host instead. A name another session has is refused and nothing moves. tmux's own ‘prefix $’ keeps doing what it does, and inside a mirror it ends the same way: see OTHER HOSTS. sessions idle[--daysn] [--print]- Every live session with no client attached and nothing happening in it for
longer than n days, three by default, most idle
first: the name, the directory, how long it has sat and how many windows
it holds. Activity is what tmux counts, output in any window included, so
a detached session with a job still printing is not idle. Picking one runs
project closeon it, layout capture and all, so a session shut from here opens again from the project picker as it was.--printlists the rows as tab-separated columns and exits. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. No such session is one line on stderr and exit 0, not an error. sessions startname [dir] [--detach]- Open a session by its name.
name‘
@host’, where host is one ofhosts, opens the mirror session of name on that host, described under OTHER HOSTS, and makes name there first when the host has no session by it, in dir on the host when one is given, where ‘~’ is the host's home; a dir the host doesn't have makes nothing and the mirror pane says so. This works whatever the host's link mode, since ‘off’ stops the list and not the attach. host is matched ignoring case when only one host fits, so ‘dev2’ finds ‘Dev2’. A host that is no host is refused, exit 1 with the hosts named, rather than read as a local name; only a live session here by that very name still attaches. Otherwise it takes the first of these that knows the name: a live session called name, which it attaches to, or switches to from inside tmux; the newest snapshot generation holding a session called name, which it restores alone, assessions resurrect--onlyname--mergewould, confirm screen and restore table included; a project directory whose session would be called name, from the directories with a saved layout and the ones[project] dirs_sourcelists, opened the wayprojectopens it; and last dir, which gets a session called name. Several project directories with the same name open the project picker on just those. With none of these the project picker asks for the directory, and a typed path is taken as well as a listed one. Off a terminal there is nobody to ask, so it says the directory is missing and exits 2. A dir given when something earlier answered is not used, and one line on standard error says so. tmux keeps a ‘.’ or ‘:’ in a name as ‘_’, and the name is matched the same way.--detachstarts or restores the session and attaches nothing. The exit codes are ‘0’ there, ‘2’ a directory missing or not a directory, the restore's own codes when a restore refused, and ‘1’ for anything else, a cancelled pick included. sessions continue[--last,--print]- Go back to the session you left: attach to it, or switch to it from inside
tmux, where the session this runs in is never the answer. tmux cannot say
which session a client detached from, since by the time its
‘
client-detached’ hook runs the client has no session, so the record is the one taken on the way in: the ‘@tc_ses_used’ stamp the switcher's hooks put on a session at every attach and switch. This sets those hooks too, asswitchdoes, so on a server whose config does not set them the record starts with the firstsessions continue. Of the sessions no client is in, or of every other session when each has a client, it takes the highest stamp; with no stamp, the latest ‘session_last_attached’; with neither, the oldest by ‘session_created’.--lastreads none of these and takes the youngest session by ‘session_created’, attached or not, other than the one this runs in.--printprints the name and the reason, a tab between them, and exits. No other session to go to is one line on standard error and exit 1. shutdown- Stop the tmux-companion daemon, and only that. tmux and its sessions are
not touched, and the next client starts a new daemon.
sessions shutdownis the one that stops tmux. restart- Stop the daemon and start a fresh one, which is how a change to
config.toml takes effect: the file is read once at
startup and held for the daemon's whole life. tmux is not touched;
sessions restartis the one that restarts it. Exits non-zero when the new daemon does not answer, which is what a config it refuses looks like; the reason is in the daemon log. keys[--all,--querytext,--refresh,--print,--unused]- Every binding tmux knows, searchable, with what it runs in the preview.
Enter runs the binding. It opens on the bindings whose note starts with
‘
companion:’, which is what the shipped configs write with-N;--allopens on everything, including a ‘prefix’ or ‘root’ binding with no note, which a plugin's often is; its command stands in for the note,--queryopens on something else,--refreshrebuilds the list from tmux rather than using what the daemon holds, and--printlists the rows and exits. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. When no binding carries the note there is nothing to show, and it says so on standard error and exits 0 rather than drawing an empty picker. Bound to ‘prefix’?.--unusednarrows the opening set to the bindings the usage log has never recorded a press for, under the title ‘[ Keys never used ]’. Never means since the log began, and the line under the list says how many bindings that is out of how many, and how many presses the log holds; with no log yet it says so and lists every binding, which is the truth on a fresh machine. With--printit writes one table key note line per binding to standard output and the same summary to standard error. It does not combine with--all: tmux's own bindings are nobody's to prune. keys discover[--layerlayer,--print]- Reads what tmux's root table binds and what the apps in its panes bind,
and saves it for
keys collide. No app is asked to do anything new. Each app is read by the best way that answers: a running instance through an interface it already has, then its own configuration or a headless start with it, then what[keys.app.name]claimsdeclares. nvim is asked live over the socket every nvim serves, one call tonvim_get_keymap() per mode and nothing else, and every nvim pane answers for itself; when none does, one ‘nvim --headless’ start with your config answers instead. Only keys tmux's root table could stand in front of are kept: Ctrl, Alt and the F keys. claude is read from its keybindings.json over a table of its default keys, fzf fromFZF_DEFAULT_OPTSover fzf's defaults, vim from ‘:map’ in a silent start with your vimrc, nano from the ‘bind’ lines of your nanorc with no defaults, since nothing installed lists them, and zsh from ‘bindkey -L’ in an interactive start; zsh is reported and never routed, since it is the command in every idle pane. fzf-lua's fzf keys come back from a live nvim when fzf-lua is loaded.--layerreads only one of ‘tmux’, ‘nvim’, ‘vim’, ‘claude’, ‘fzf’, ‘nano’ or ‘zsh’, and--printwrites one layer mode key rung pane description source line per binding as well. What could not be read goes to standard error, one line per layer. It runs in the client; the daemon never starts or connects to an editor. keys collide[--json,--refresh]- The keys tmux's root table binds that an app binds too, with every app
that wants each one and the modes it wants it in, followed by the Ctrl,
Alt and F keys nobody binds, for when a new shared action needs a home.
Two spellings of one key, such as
‘
M-S-a’ and ‘M-A’, count as one. A key the registry describes, with a field naming a layer and a word or two its binding should contain, is listed as drift when that layer binds it to something else or to nothing; collisions show the route the registry gives them. It reads the lastkeys discover, and discovers first when there is none or with--refresh.--jsonprints the report instead of opening the picker. keys route[--dry-run,--print]- Wraps tmux's root bindings so that a key the app in front of a pane wants
is held rather than taken. It belongs on the last line of tmux.conf,
‘
run-shell "tmux-companion keys route"’, because it reads the root table as tmux.conf left it. Each Ctrl, Alt or F binding in root moves, untouched and with its note, into the ‘kc-tmux’ table, and root gets a wrapper carrying the same note. When nothing claims the key it runs the binding at once. When something does, it waits[keys] hold_ms, 170 by default: a second press in that time sends one key to the app, and when the time runs out, or another key comes first, tmux runs its binding and the other key follows. A claim is the pane-option contract below, or a static claim: whatkeys discoverfound for the app in front, in the modes that count, plus[keys.app.name]claims. A key whose name has punctuation in it is left alone.[keys.key.key]routesettles one key: ‘hold’, the default, ‘app’, which hands a claimed key to the app at once and runs tmux's binding at once otherwise, the way vim-tmux-navigator shares its keys, or ‘tmux’, which leaves the key unwrapped; itshold_msoverrides the one in[keys]. With[keys] routeoff, the default, it puts every wrapped binding back and does nothing else; below tmux 3.4 it says so and wraps nothing. Running it again after tmux.conf is sourced wraps the fresh bindings. It prints nothing unless something fails;--printsays what was wrapped and what was left alone, and--dry-runprints the tmux script as well and applies nothing. keys claim[--appname] [--owner] [-tpane] [key ...]- Sets the pane options a wrapper reads, spelled the way it matches them,
for a hook or a wrapper script. The keys go into
‘
@kc_claim’;--appsets ‘@kc_app’, for an app whose process name doesn't say what it is;--ownerrecords the pane's current command as ‘@kc_owner’, so the claim stops counting once something else is in front. The pane isTMUX_PANEunless-tnames one. keys release[-tpane]- Unsets all three.
The contract, for anybody writing a publisher: code inside an app that keeps its claims current as its mode changes. ‘
@kc_owner’ is the ‘pane_current_command’ tmux shows for the app; ‘@kc_claim’ is the keys claimed right now in tmux's spelling, each between pipes, with a pipe at both ends: ‘|M-a|M-1|C-q|’. A claim counts only while the pane's command equals ‘@kc_owner’, so one left behind by an app that crashed stops counting once the shell is back. While ‘@kc_owner’ names the app in front, its static claims don't apply: a publisher that claims nothing in this mode unsets ‘@kc_claim’ and means it. cheatsheet[--print]- The bindings you keep looking up, so you learn them and stop. A pick in
the
keyspicker is a binding looked up rather than pressed, and with[usage] enabledon the log records each one with its time. A binding looked up within the last[usage] learned_after_days, 14 by default, is still being learned: it goes at the top of its box with a ‘▸’ and its count, most lookups first. One with lookups but none that recent has been learned and leaves the sheet; the line under it says how many did. 0 days means nothing is ever learned. A pick logged before picks carried a time counts as learned until it is looked up again.Three boxes hold the bindings noted ‘
companion:’, by the word after it: panes, windows, sessions and projects; copy mode, opening and searching; config, help and anything else. The ones never looked up follow the marked ones, alphabetical. The fourth box, tmux and plugins, holds bindings without that note, and only ones looked up recently: tmux's own show tmux's note, and one with no note shows its command. A default nobody looked up is never listed.With the usage log off, every ‘
companion:’ binding is shown unranked, the fourth box is empty, and the line under the sheet says it learns only with the log on.--printwrites one line per entry instead of drawing the sheet: box state count table key shown note, tab-separated, where box is 1 to 4 in reading order and state is ‘learn’ or ‘unused’. The line under the sheet goes to standard error.--plainis the old spelling and still works. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. The same hint askeyswhen no binding carries the note. Bound to ‘prefix C-c’. agentbusy|asked|done[--paneid]- What an agent is doing, said by the agent itself. Run from one of its
hooks, it tells the daemon that the agent in
$TMUX_PANEis working (busy): a prompt was sent or a tool just ran , has stopped on a question or a permission prompt (asked), or has finished its answer and waits for the next prompt (done). The last word per pane wins over the window's quiet time everywhere the daemon reads it: the bar'sagentssegment, the inbox, thepanespicker and the brief, and it lasts as long as the pane runs one of[agents] programs. Nothing is printed and the exit is 0 whatever happens, since the command runs inside the agent's own hook and an error there would land in its transcript; outside tmux it does nothing.--panenames another pane. agent clear[--paneid]- Forget what the pane last said, so the window's quiet time decides again: for an agent restarted without its hooks in a pane that still carries the old one's last word.
agent hooks[program]- Print the hooks block for an agent's settings file, the way
shell-initprints the prompt marks. For ‘claude’, the only program so far, that is ‘UserPromptSubmit’ and ‘PostToolUse’ saying busy, ‘Stop’ saying done, and ‘Notification’ on a permission prompt or ‘PreToolUse’ on ‘AskUserQuestion’ saying asked, and ‘SessionStart’ and ‘SessionEnd’ runningkeys claim --app claude --ownerandkeys release, so key routing knows a pane whose process is named for claude's version is claude; all of it to merge into ~/.claude/settings.json. ‘idle_prompt’ is left out on purpose: it fires a minute after every answer and would turn eachdoneinto a question. Between a hook and silence sits the terminal bell: an agent that rings it sets the window's bell flag until the window is visited, and an agent pane with the flag up reads as asked. inbox[--print]- The agents waiting on you, longest wait first, each with the question it
asked: the daemon captures the last lines of an agent's screen the moment
it stops drawing, or the moment its hook says
askedordone, so the question is on record for a window nobody has looked at since. The third column says how it stopped and for how long: ‘asked 3m’ for a hook or the bell, ‘done 3m’ for a hook that said the answer was complete, which is on the list to be read rather than answered and is not coloured, and ‘waiting 3m’ for silence alone. Enter switches the attached client to that pane.--printwrites where, program, state and how long, the question and the pane id as tab-separated columns. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. The question is the last line of the screen that is something the agent said: the input box at the foot of the screen and whatever is under it are cut, and then every line matching one of[agents] question_skip, a list of regular expressions that ships covering rules, spinners, hints and a dialog's numbered options.[agents] inboxturns the capture off, and[agents] nudge_after_secssays it out loud once an agent has waited that long, unless it saiddone, which is an answer and not a question. panes[--agents,--print,-tsession]- Every pane on the server, one row each: where it is as
‘
session:window.pane’, what it runs, whether it has gone quiet, and its directory, with the last lines of its screen in the preview. Enter switches the attached client to that pane, whatever session it is in. The pane this runs in is left out, since jumping to where you are is nothing. The state column reads ‘busy’, ‘asked 3m’, ‘done 3m’ or ‘waiting 3m’ for a pane running one of[agents] programs, the first three when the agent said so throughagentor rang the bell and the last when only the window's quiet time is known, ‘active’ or ‘idle 3m’ for anything else, and ‘reading’ for a pane in copy mode. Quiet is measured on the window rather than the pane, because tmux keeps no activity time per pane: an agent beside a shell you are typing in reads as busy. The program column carries the pane's title after a dash when a program set one, which is how two ‘claude’ panes in one directory are told apart.--agentskeeps only the agent rows,-tonly one session's, and--printwrites the rows as tab-separated columns with the pane id last, and exits. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. With nothing to show it says so on standard error and exits 0. Bound to ‘prefix g’, and ‘prefix G’ with--agents. jump[--paneid,--clientname]- Go to any text on the screen by typing a few of its characters and then
the label that appears beside it, the motion
flash.nvim
gives neovim, over every pane in the window. A borderless popup is laid
exactly over the window and shows what each pane shows, greyed. As the
search is typed, its matches light up in the theme's colour, nearest the
cursor first, and each gets a letter on the cell after it. No label is
ever a letter that would continue a match, so typing on narrows the search
and typing a label jumps, and a match keeps its letter while the search
narrows. The search ignores case until it holds a capital. Enter takes the
nearest match; escape, or backspace on an empty search, closes it. The
jump selects the pane, puts it in copy mode and moves the cursor to the
match by row and column, so a selection already started extends to it. A
pane already in copy mode is searched where its view is scrolled to.
--paneis the pane the key was pressed in and--clientthe client to open the popup on, both from the binding. It replaces tmux-jump, which took one character and, on tmux 3.5 and later, landed a column further right for every line above its target. Bound to ‘prefix Space’, and to ‘s’ in copy mode. search[pattern] [-F,--kindkind,-tsession,--paneid,--linesn,--print,--first]- Every line of every pane's scrollback, one row each and the newest first:
where it is as
‘
session:window.pane’, what the pane runs, and the line, with the five lines on either side of it in the preview. Enter switches the attached client to that pane, puts it in copy mode scrolled to the line and selects the line, so what you found is what's highlighted and the copy key takes it. The panes are read most recently active first, a blank line is no row, and a line one pane drew twice is one row at its newest, so a prompt drawn forty times doesn't fill the list. pattern keeps only the lines it matches. It's a regular expression, matched in either case unless it holds a capital letter, and-Ftakes it as text, for an error message full of brackets.--kindis a stored search in place of a pattern:url,path,shaorip.-tkeeps one session's panes and--paneone pane.--linesis how far back each pane is read, 1000 when nothing says, and the list stops at 20000 rows.--printwrites the rows as tab-separated columns and exits: where, the pane id, the line's number as tmux counts it, with 0 the top row of the screen and the history below zero, and the line. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it.--firstgoes to the newest match without showing the list, and needs a pattern or a kind. A line is a line the terminal drew, so a URL that wrapped is two of them and neither matches whole. What a pane wrote while the list was open moved the line up, so at landing the pane is read again and the line found by its text, which also holds for a pane whose history is already at ‘history-limit’ and can't grow. The stored searches come from tmux-copycat, which hasn't been pushed since May 2023, and the fuzzy list over one pane is tmux-fuzzback, which is the one to install on a machine that doesn't run this. Bound to ‘prefix /’. ports[--all,--udp,--print,-tsession,--kill,--gracesecs]- The TCP ports something is listening on, one row each: the port and its
protocol, where it can be reached from, the program and its pid, the pane
that started it as
‘
session:window.pane’, and that pane's directory, with the last lines of the pane's screen in the preview. Enter switches the attached client to the pane. The address column reads ‘*’ for every interface, ‘localhost’ for either loopback, or the address it is bound to, and a program listening on one port over IPv4 and IPv6 is one row. A port belongs to the pane whose own process is an ancestor of the one listening, so a server started by a script started by an agent is still that agent's pane's. Only the ports a pane started are listed;--alladds the rest after them, with a dash for the pane.--udpadds the UDP sockets that are bound and connected to nobody, which is as near as UDP comes to listening; it's asked for rather than given because any program that resolves a name holds one for a moment.-tkeeps one session's, and--printwrites the rows as tab-separated columns and exits: port, protocol, address, program, pid, where, and the pane id. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. With--killenter stops the program where it would have gone to the pane: TERM to the process holding the socket, and KILL if it's still there after--graceseconds, 3 when nothing says. Only that process is signalled and not its group, since what started it is often the pane's shell. The sockets come from lsof(8), or from ss(8) on a machine without it, and either one names only the processes you own unless you're root. Bound to ‘prefix P’. new-window[--print]- A window here, or at any directory. The rows are the pane's own directory
and then the same source
projectlists, so it is the one setting for both. The query starts on the pane's own directory, which is also the first row, so the key and enter is another window here. A path the source has never seen opens when it is typed in full.--printwrites the rows and exits: a column that says ‘here’ on the pane's own directory, the short path and the full one. Bound to ‘prefix c’. run[--paneid]- A command from shell history, run in a pane that slides out beside this
one and waits for an answer before closing.
--panenames the pane the side pane belongs beside. The shipped binding passes nothing, and then the session an attached client is looking at decides. Both exist because the picker draws insidedisplay-popup, which is not a client: an untargeted split is resolved against whichever session the server touched last, so the command ran in a window nobody was looking at. tmux does not expand ‘#{pane_id}’ in adisplay-popupcommand at all, and expands it in arun-shellone to the pane the server touched last rather than the pane the key was pressed in, which is why the flag is for a caller that knows the pane and not for the binding. Bound to ‘prefix e’. theme pick[--themesdir]- Every theme with its colour beside it, applied on the spot and remembered
against the project in _project-map.tsv. It goes
to the session the key was pressed in, found from
TMUX_PANEin a pane and from the sessionTMUXnames in a popup;-tapplies it somewhere else. A session in a group is the group: every session in it is painted, the pick is remembered under the group's name, and a grouped session made later takes the group's theme from the ‘session-created’ hook. That is what makes a pick inside a mirror session reach the host session for everybody, since the mirror attaches through a grouped session whose bar is off. Each client looking at the group is told ‘theme Amber on api’ on its message line, a mirror's excepted. The session also gets ‘@theme-file’, the theme's file name, which ‘@theme-name’ is not. Bound to ‘prefix C-t’.
SESSIONS AND WINDOWS
Section titled “SESSIONS AND WINDOWS”note[text] [--paneid,--clear]- Leave a one-line note on a pane: tmux's pane title, which
panesshows beside the program and the pane border draws whenpane-border-statusis on. With no text it prints the note that is there;--cleartakes it off. A snapshot carries the note and a restore puts it back. The pane defaults to the one the key was pressed in. An agent working beside you can say what it is doing in four words with this, and the skill file tells it to. quiet[duration] [--off] [--focus[name |--focus-off]]- Quiet hours. For the duration given,
‘
45m’, ‘2h’ or a bare number of minutes,[notify]announces nothing, the inbox nudges nobody, and theagentssegment leaves the bar; the health mark is a crossed-out bell in its place, so the silence reads as chosen rather than broken, andhealthsays ‘quiet’ in words. With nothing given it says how long is left;--offends it now.[quiet] dailyturns it on at the same local times every day, such as ‘22:00-08:00’; a timer and a window together last until the later one ends. The daemon keeps the clock, so every timer and every client agree.--focus[name] says a Focus started and--focus-offthat it ended: quiet holds until then, andquietandhealthsay ‘quiet while Focus Work is on’. They are for a hook to call; on macOS that is a Shortcuts automation, “When Work turns on”, running ‘tmux-companion quiet --focus Work’ through Run Shell Script with the binary's full path, and a second for “turns off”.--offends the timer and leaves a Focus on. With[quiet] follow_focuson macOS the daemon follows the Focus itself, from the database in ~/Library/DoNotDisturb/DB: one stat every two seconds and a read when it changed. Reading it can need Full Disk Access for the terminal tmux runs in; when it cannot be read the health mark says so once and quiet keeps to the timer anddaily. On Linux the same setting follows the desktop's Do Not Disturb over the session bus, one connection and its signals, with no timer and no process: GNOME's ‘show-banners’, read from the dconf user database when dconf says it was written, KDE Plasma's ‘Inhibited’, dunst's ‘paused’, mako's ‘do-not-disturb’ mode and SwayNotificationCenter's Do Not Disturb. The line is then ‘quiet while “Not Disturb is on,’ as it is for the Do Not Disturb Focus on macOS. No session bus is one health reason.” chunk[status[--json] |snooze|reset|close|budgetduration]- The chunk clock: how long you have been at tmux this sitting, across every
session, with nothing to start. Time counts while an attached client has
the OS focus, which needs
focus-events on, and saw a key or click within[chunk] break_after; a shorter gap counts as work, and one that reaches it is a break that ends the sitting. Thechunksegment of[[status.right.segments]]draws a timer and ‘38m’, amber past[chunk] warn_atof the budget, and an alert timer and ‘50m+12’ in red past it, with ‘• 1h14m’ after either when the pane in front runs an agent, how long it has been running, unless[chunk] agent_ageis off. At budget the daemon plays the ‘chunk’ earcon once, at the next window switch, prompt coming back or agent finishing its turn, and at most[chunk] boundary_gracelate; quiet hours keep the sound and drop the[chunk] banner.status, the default, says the sitting in words, ‘38 min, 12 min for break’ or ‘1 hr 7 min, 17 min passed break time’, and nothing when no sitting runs;briefsays the same line.snooze, past the budget, grants one extension of[chunk] snoozeand one more sound, once a sitting.resetstarts a new sitting at 0,closeends this one until you have been away and back, andbudgetsets this sitting's budget until a reset or a daemon restart. The sitting survives a daemon restart in $XDG_STATE_HOME/tmux-companion/chunk.toml. A terminal that does not report focus reads as focused forever, and there only the key counts. journal[--print] [-tsession] [--daysn]- What happened in each project, newest first: a command that ran past
[journal] min_secsand finished, with how long it took; an agent that stopped and what it asked; an agent that worked one turn past[journal] agent_min_secsand said it was done, with how long and the last line of its answer; a project opened or closed. Enter goes to that session.-tkeeps one session and--daysreaches further back than the last day.--printwrites the rows as tab-separated columns. Without--print, inside tmux, the line saying there is nothing to show also goes to the tmux message line, so a popup that closes does not take it with it. The daemon writes it to journal.tsv in the state directory as it happens. It is off by default. switch windows[session] [--reverse,--clientname,--print]- Move between this session's windows in the order they were used, the way
Cmd-Tab moves between applications. Run from
run-shell, with no terminal, it is one press of the key. With[switcher] firstset to ‘flip’, the default, the first press goes to the window you were on before and draws nothing, once[switcher] flip_wait_ms, 150 milliseconds unless set, has gone without a second press. A second press inside that wait opens a popup listing the windows, most recently used first, with nothing moved and the candidate on the window you were on before; a second press after it but within[switcher] pause_ms, 500 milliseconds unless set, opens the list over the window the flip went to, on the next older one.flip_wait_ms= 0 flips at once. With ‘list’, the first press opens that list and nothing moves until a commit. Inside the list the same key moves on and, with shift, back; Enter commits, and Esc goes back to the window the presses began in. With[switcher] commitset to ‘pause’, the list also commitspause_msafter the last press. Typing filters the list, and stops that clock. The window you are in carries the word ‘now’. With[switcher] announce, on by default, each press puts the candidate's name and its place, such as ‘ai, 2 of 4’, on the message line.--reversegoes the other way,--clientis the client the key was pressed on, which the binding passes as ‘#{client_name}’, and--printprints the windows, index and name, most recently used first, one to a line. In a mirror session the windows are the host's: the current one first, then the rest by index, as the daemon last heard them over the link, or a line saying they haven't been heard yet followed by the mirror session's own window. Run in a terminal, such as a popup, it is the list.The order comes from hooks that only set options, so a switch starts no process: ‘
session-window-changed[73]’, ‘client-session-changed[73]’ and ‘client-attached[73]’ count every switch into ‘@tc_seq’ and stamp the window or session with it as ‘@tc_win_used’ or ‘@tc_ses_used’.switchsets them each time it runs. A window never stamped comes after every stamped one, tmux's last window first.Under ‘
flip’ the second press opening the list is timed, and so is the commit undercommit= "pause".[switcher] first= "list" withcommit= "enter" has no clock in it at all. Bound to ‘M-a’, and with--reverseto ‘M-A’, in the example configs. switch sessions[--reverse,--print]- The project picker opened as a session switcher: every session, most
recently used first, with the cursor on the one you were in before, or
with
--reverseon the oldest. The session key, Alt held, moves on and with shift back, Enter goes and Esc stays; there is no clock. The project directories are in the list but hidden until something is typed, so the first letter turns it into the project picker's search, and a typed path opens as it does there. A search filters without reordering: the sessions stay first, by when each was last used, and the projects follow, by when each was last jumped to, read from zoxide's database; another source keeps its own order.After this machine's sessions comes each host's, in the order
hostslists them: a line for the host, ‘vm, 4 sessions, last heard 15m’, or ‘live’ while its link is up, then each of its sessions as ‘api@vm’, in the host's own order of use, with ‘idle 3d’ and ‘attached on vm’ as a local row has them. In the list a host's line shows only while nothing else stands for the host: once it has a session row, or a mirror session open here, those rows are the host, each with the ssh glyph and ‘@vm’ in the host's colour, and the preview of a session says the host's line.--printkeeps every host's line. The rows come from what the daemon last heard, kept on disk, so they are there before any ssh has run; opening the list asks the daemon to bring each host's link up afterwards, and nothing in the list waits for it. While a host can't be reached its rows stay, each saying ‘unreachable’ and drawn in a faint tone, and the preview of any of them says why and when it was last tried. Enter on a host's line, or on one of those rows, tries the link again and says ‘vm: connecting’ on the message line. The session key steps over host lines and unreachable rows, landing only on sessions, and the cursor starts on the second session whichever machine it is on. The message line says each step as ‘api on vm, 5 of 9’. Enter on a host's session opens it as the host'sopensays, a mirror session by default, and a typed ‘name@vm’ that is no session's name gets a row of its own at the top, ‘new session name on vm’, so a loose match further down can't take Enter. Enter on it asks where on the host the session starts, in a second list in the same popup: the host's home, ‘~’, first, then the directories the host lists, and a typed path as a row saying ‘start in ~/src/x on vm’. Esc makes nothing. ctrl-o on a host's line, one of its sessions or a mirror session open here asks for the name first, in a list of the sessions the host already has with the same kind of row for a new one, then where. Nothing typed in either goes through tmux's command parser or a shell here: the name and the directory are arguments, quoted once for the host's shell. alt-enter on a host's session opens it the other way, once: it hands the terminal over for a host that mirrors, and mirrors one that hands over. A mirror session that is open is listed once, among this machine's sessions.ctrl-x on a host's session row, or on a mirror session open here, asks in the same popup what it is for, one row each: ‘
keep api@vm’, first, so Enter at once does nothing; ‘kill api on vm, and every mirror of it’, which runshost kill; and ‘forget vm’, which runshosts forget. For a host that can't be reached the middle row drops the cached row instead, which the next answer from the host brings back if the session is still there. Esc keeps both. What happened is said on the message line. On a host's line it closes the list and asks ‘forget vm? y/n’ on the message line, where one key answers and only ‘y’ forgets, then opens the list again on the same row; it is refused, with the reason, while a mirror session to the host is open. On one of this machine's own sessions it says that ctrl-x is for a host's rows. ctrl-n on a host's line, one of its sessions or a mirror session opens the formhosts addopens with no arguments. A host whose line is not shown is forgotten withhosts forget.--printprints the session names, most recently used first, then each host's line with the reason after ‘unreachable:’, and its sessions, the same lines in the same order with no glyph and no padding. Bound to ‘M-s’ and ‘M-S’ in the example configs. project close[session] [--discard,--no-save]- Close a project by asking every window to exit, capturing the layout on
the way out. An editor is asked to quit first, in its own language, and
the close stops with the editor on screen when it will not; the editors it
knows are
nvim,vim,viandhx. Everything else, an editor it does not know included, gets ‘exit’ or ctrl-D.--discardquits editors with ‘:qa!’ and throws away unsaved work. A session that is not there is an error rather than a session that closed at once. Bound to ‘prefix X’. pocket[name] [--paneid]- A shell you pull out beside the pane you are in, look at, and put away
without losing it. The first press splits a shell off the side of the
window at
[run] width_percent; the second parks it in a window called ‘_pocket’; the third brings the same pane back beside wherever you are now, its process and its scrollback as they were. name tells one pocket from another when a session keeps more than one, and defaults to ‘shell’. A pocket is known by the pane option ‘@tmux-companion-pocket’ rather than by its title, which a shell is free to change.switch windowspasses the ‘_pocket’ window, andproject saveleaves it, and any pocket that is out, off the layout it writes.--paneis the pane the key was pressed in, which the binding passes. Pressed inside the ‘_pocket’ window it does nothing and says so. Needs tmux 3.1 for pane options. Bound to ‘prefix `’. promote[name] [--paneid]- Give a pane a session of its own, its process and its scrollback with it:
for the pane opened beside the editor to look at another repository, which
an hour later is the thing being worked on. The session is named the way
projectnames one, from the pane's directory, so it is the sessionprojectfinds the next time that directory is picked. name is for when the directory's name won't do. When a session of that name is already there the pane joins it as a window, and when the pane is all its own session holds the session is renamed and nothing moves. A pane already in the session it would be given is refused, with a line saying to pass a name. The attached client follows the pane, and the journal gets an ‘opened’ line for a session this made.--paneis the pane the key was pressed in, which the binding passes. The idea is tmux-sessionist's ‘prefix @’, which asked for the name, and it hasn't been pushed since May 2023. Bound to ‘prefix @’. kill[--paneid,--gracesecs,--ask]- Stop what runs in front in a pane, for a program that stopped answering
‘
C-c’. The foreground process group of the pane's terminal gets TERM, which a program can catch to put the terminal back and remove its lock file, and KILL when it's still running after--graceseconds, 3 when nothing says. The group is the one the terminal delivers ‘C-c’ to, so a build goes together with the compilers it started and a job put in the background with ‘&’ is left alone. It prints how it ended, ‘cargo stopped on TERM’ or ‘cargo ignored TERM for 3s and was killed’, and exits 1 when the program is still there after KILL or could not be signalled. A pane with nothing in front but its own shell is refused, since stopping that closes the pane and tmux has ‘kill-pane’ for it.--paneis the pane the key was pressed in, which the binding passes.--asklooks before it asks: a shell at its prompt is refused with no question, and anything else gets tmux's own confirmation naming the program and its pid, whose yes runs the stop. tmux-cowboy was the one key for this, sending KILL with no TERM before it, and was last pushed in May 2021. Bound to ‘prefix K’ with--ask, so the confirmation names what it stops. zen[--paneid]- Clear everything but the pane you are working in. With other panes open
that is tmux's own zoom: this pane fills the window, the rest are hidden,
and the same key puts the layout back untouched. With no other panes there
is nothing to zoom -- a lone pane already fills the window, and tmux's own
‘
prefix z’ does nothing at all there -- so the key takes the status bar instead, which is the only clutter left. One key for "give me the most screen you can", whatever the window looks like.zoomis the old name and works for one more release. Bound to ‘prefix z’. autosave[--once,--status]- Deprecated: the
[autosave]script timer, which[sessions] autosavereplaces.--onceruns the script now,--statussays when it last ran, and with no flag it reports, the same as--status.
OTHER HOSTS
Section titled “OTHER HOSTS”A host is another machine with its own tmux and its own
tmux-companion, reached by a command that opens ssh to it. The daemon keeps
a link to each host's daemon: one host command per host,
‘ssh vm 'tmux-companion bridge'’,
carrying Cap'n Proto messages over the ssh session's stdin and stdout.
Nothing listens on either machine and nothing new opens a socket; the local
side starts every link and asks every question, and the host answers only
the questions its bridge has, none of which runs a command or changes
anything. Everything a host sends is taken as untrusted: control characters
are dropped, a string is cut at 4 KiB and a list at 500 sessions.
While a link is up the host tells this side what changed when it
changes: its sessions, its waiting agents and the bar of each grouped
session this machine has a client in, each sent when the host's own poll
sees it change, so nothing is asked on a timer. The daemon pings the host
every ping_secs, 15 by default, since a link that
died quietly would otherwise go unnoticed; three pings unanswered in a row
and the link is restarted, saying ‘no answer to 3
pings in 45s’. A host whose bridge is older and can't push is
asked for its sessions every poll_secs, 5 by
default, instead, and hosts says its bridge lacks
‘watch’. The last answer is kept on
disk either way, so a host is listed with when it was last heard from before
any ssh has run. A link that fails is tried again after 5 seconds, then 10,
doubling to 5 minutes, and at once when something asks for it. The link runs
with no controlling terminal and SSH_ASKPASS_REQUIRE
set to ‘never’, so ssh fails and says
why rather than waiting on a password or a host key nobody can see; host
keys stay strict. Set ‘BatchMode yes’
and a ‘ConnectTimeout’ for the host in
~/.ssh/config as well.
A host's sessions are listed in switch
sessions, and picking one opens a mirror session: a session here
called ‘api@vm’ that stands for
‘api’ on
‘vm’, holding one window whose pane
runs host attach. That pane runs the host command
with -t and attaches to a session of its own on the
host,
‘api~machine’,
named for this machine and grouped with
‘api’, so this machine keeps its own
current window there and two machines don't collide. The grouped session
carries ‘@tc-mirror’, has its bar off,
and goes when this machine detaches. It sets
‘detach-on-destroy on’ for itself,
whatever the host sets globally: when the last pane of
‘api’ goes, the attach ends and
‘api@vm’ closes, rather than the host
moving it to another of its sessions while it is still called
‘api@vm’. The host's own pickers,
brief, sessions idle,
snapshots and bar leave it out, so a person at the host sees what they saw
before. Grouped sessions share their windows, and
‘window-size’ is a window option, so
both machines size the same windows; the host's setting is left as it
is.
A rename follows through. ‘prefix
$’ inside a mirror session goes to the host, where tmux
renames the grouped session to what was typed; the host's daemon takes that
as the session's new name, renames
‘api’ to it and the grouped session to
‘web~machine’,
and moves the session's project colour. A session renamed on the host any
other way, with sessions rename or tmux itself, has
its grouped sessions renamed to match. This machine finds the session again
by its tmux id, which a rename keeps, renames the mirror session
‘api@vm’ to
‘web@vm’ and its
‘@tc-remote’ to
‘web’, and says
‘api on vm is now web’ on the message
line; the mirror pane attaches to the new name when it next connects. A host
from before this build does neither, and the mirror keeps the old name until
it is opened again.
The mirror session sets
‘prefix’ to
‘None’: in it, and only in it, the
prefix key goes to the host's tmux, and this machine's prefix is out of
reach. ‘M-s’ is this machine's
switcher there as everywhere, and is the way out. A
‘prefix2’ you set stays this
machine's. ‘M-a’ and
‘M-A’ go on to the host, whose own
switcher moves through its windows: switch windows
sees ‘@tc-host’ on the session and
sends the key to the mirror pane. The session also carries
‘@tc-host’ and
‘@tc-remote’, naming the host and the
session there, and ‘detach-on-destroy
previous’, so a detach on the host closes it and puts the
client back where it came from. The message line says
‘api on vm’ when the switch to it
happens.
The bar in a mirror session is this machine's. The daemon asks the
link for the host session's git, agents and health once a second while the
mirror session has a client, builds the right side from those words itself,
never from markup the host sends, and sets it as the session's
‘@tc-right’ in every bar mode,
followed by this machine's own health as ‘here:
reason’ when it has one. With the link
down the right side says ‘vm: no
link’. The example configs read
‘@tc-right’ first when
‘@tc-host’ is set, and draw
‘@vm’ and the ssh glyph on the left in
the host colour, the tmux options
‘@tc-host-fg’ and
‘@tc-host-bg’, which the ssh hostname
on the bar uses too. The pickers draw each host's name in its own
colour instead, so two hosts' rows read apart.
The window list in a mirror session is the host's. A mirror
session has one window here, the pane the attach runs in, so the host sends
the grouped session's windows with its segments and the daemon draws them in
that window's entry: each as
‘index:name’, with
‘*’ on the current one and
‘!’ on one that rang, the current one
in the window's own
‘window-status-current-style’ and the
rest in its ‘window-status-style’,
joined by ‘window-status-separator’.
It does so by setting the session option
‘@tc-windows’ and pointing the
window's ‘window-status-format’ and
‘window-status-current-format’ at it,
with the window's two styles kept in
‘@tc-windows-style’ and blanked
meanwhile; with the link down, or a host whose build sends no windows, the
window gets its own entry and styles back. A window name is text: a
‘#’ in it is drawn, never expanded. A
click on one of the host's windows in the list selects the mirror window and
nothing more; the window key, or the host's prefix, moves between them.
The theme in a mirror session is the host session's.
‘prefix C-t’ there goes to the host,
as every prefix key does, and the pick paints the host session and every
session grouped with it; see theme pick. The host
sends the theme with its segments, as its file name and the
‘@theme-*’ settings that file makes,
and the daemon here sets them on the mirror session between this machine's
own _reset.tmux and
_apply.tmux. They are set as arguments, never
sourced: a key is ‘@theme-’ and
lowercase letters, digits and ‘-’, a
value a tmux colour, or words for
‘@theme-name’, and anything else is
dropped. A theme this machine has no file for is written to its themes
directory, so the picker here lists it; a file already there by that name is
left alone. A change of theme is said on the message line,
‘theme Amber on api@vm’; opening a
mirror session paints it without a word. The last theme heard is kept while
the link is down. Before the first one arrives, and with a host whose build
sends none, the ‘session-created’ hook
paints the mirror session as the session on the host,
‘api’ rather than
‘api@vm’, which with
[theme] default = "by-name" is the colour
the host gives it by itself. Nothing is painted without a
_apply.tmux here; run theme
init first.
When the attach ends other than by a detach the pane says how in
one line, ‘the connection to vm ended: Connection
timed out’, or ‘api no longer exists
on vm’, and waits: ‘r’
connects again and ‘q’ closes the
mirror session. Nothing is timed, and a link coming back does not reconnect
on its own.
The rest of this machine's surfaces read the hosts too.
brief gives each host one line,
‘vm: 4 sessions, 1 agent asked, last heard
12s’, or ‘vm: 4 sessions, last heard
3d, unreachable: Connection timed out’, from what the daemon
already holds; it starts no link, since it runs when a client attaches. The
project picker lists every session on every host, as
switch sessions does, and the directories of one
place: this machine's source when it is opened from a local session, and
inside a mirror session that host's own configured source, asked over the
link and listed as ‘api@vm’. The host
runs its own source; nothing this machine sends names a command. Picking a
host's directory opens a mirror session whose pane runs
project --detached dir on the
host before the attach, and a path typed there, in the picker or in
switch sessions, is the host's to read.
While a host's link is up its waiting agents are in this machine's
inbox and brief, each with
‘on vm’ after its place, and an agent
that asks there plays this machine's earcon, held by quiet hours here like
any other. Their words are text: control characters go and nothing in them
reaches a tmux format. Picking one opens the mirror session with the agent's
window and pane chosen on the host after the attach; with the mirror session
already open, its pane's attach is started again with the same choice, one
reconnect. The link itself stays read-only.
Snapshots keep a mirror session with its host and the session
there, its pane recorded as ‘tmux-companion host
attach vm api’. sessions resurrect
reopens it through a shipped [[restore.program]] row
that adds --wait: the pane says
‘vm: press r to connect’ and runs no
ssh until ‘r’, so a restore after a
reboot doesn't start a dozen handshakes at once.
hosts[--print]- In a terminal, a picker of the hosts: each host's line, then its sessions,
a session whose mirror is open here with ‘
open here’ after it. Each row's preview ends with the keys it takes, one a line. On a host's line, Enter brings its link up now, ashosts connectdoes; ctrl-e opens the add form filled in to edit it, ashosts editdoes; ctrl-x asks, keep first, and forgets it; ctrl-o makes a session on it, asking for the name and the directory; ctrl-w closes every mirror of it open here. On a session, Enter opens its mirror here and switches to it; ctrl-w closes that mirror and leaves the session on the host, ashost closedoes; ctrl-x asks whatswitch sessionsasks, keep, kill it on the host or forget the host; ctrl-r asks for a new name and renames it on the host, ashost renamedoes. ctrl-n adds a host from any row. What a key did is said in the footer in words, and the list opens again on the same row. With no hosts, it is the add form.With
--print, or off a terminal, each host on one line, in the order the configuration lists them and then the ones added for this tmux server: its name, its link mode, whether the link is up and why not when it isn't, when it is up whether the host is ‘pushing’ or ‘polled every 5s’ (itspoll_secs, for a bridge that doesn't serve ‘watch’), when the host was last heard from, how many sessions it has, its build and its tmux, which methods its bridge lacks when it is older than this one, and whether the bridge had to start the host's daemon. Under each host, one line per session in the host's own order of use, as ‘api@vm, 3 windows’, with ‘attached on vm’ when somebody there is in it. Sessions on the host that are another machine's view of one of its own, carrying ‘@tc-mirror’, are never listed. It reads what the daemon has and starts no link. hosts add[name [--save]--command ...]- Add a host. The name is letters, digits,
‘
-’ and ‘_’, up to 32, since it ends up in session names, file names and shell lines. The command is an argv, or one argument split by shell-word rules without a shell; ‘$’, ‘|’, ‘;’ and backticks are refused either way. Without--savethe host is kept in the tmux server option ‘@tc-hosts’ until the server exits; with it, a[[hosts]]entry is added to config.toml, keeping every comment in the file. A name already in use is refused with the command that host is reached with.With no arguments, in a terminal, it is a form: two labelled lines, name and command, Tab between them, the cursor in the one being typed into. The name fills itself in from the command until you type your own: the command's last word that doesn't start with ‘
-’, any ‘user@’ dropped, cut at the first ‘.’, so ‘ssh dev@vm.local’ gives ‘vm’, and ‘vm-2’ when ‘vm’ is taken. Enter tests the command with one hello and says ‘vm answered: tmux-companion 0.10.0, tmux 3.4’ or why not; then ‘s’ keeps the host in config.toml, ‘t’ keeps it for this tmux server, any other key goes back to editing, and Esc leaves. Each state is one line. It has no key of its own;setupoffers one, and inswitch sessionsctrl-n on a host's row opens it. hosts forgetname- Forget a host: its cached sessions, and its
[[hosts]]entry in config.toml, every comment kept, or its place in ‘@tc-hosts’. Refused, with the reason, while a mirror session to it is open. hosts editname [--renamenew] [--command ...]- Change a host where it is kept: its
[[hosts]]entry in config.toml edited in place, its other keys, its place and every comment kept, or its place in ‘@tc-hosts’. The command after--replaces its command, read ashosts addreads one; without one it keeps the command it has.--renamegives it a new name, refused while a mirror session to it is open and when the name is another host's. One line says what changed: ‘vm is now box, reached with ssh box’. In thehostspicker ctrl-e opens the add form filled in, whose ‘s’ keeps the change. host attachhost session [--create[--indir]] [--dirdir] [--windowindex] [--paneid] [--wait]- What a mirror session's pane runs: one line,
‘
connecting to vm for api’, then the host command with-tand the grouped attach, in this terminal, so anything ssh asks is asked where you can see it.--createmakes the session on the host first when it isn't there, in--indir when given, with ‘~’ the host's home; a dir the host doesn't have makes nothing, and the pane says ‘docs wasn't made on vm: the directory asked for isn't there’.--dirrunsproject --detacheddir on the host first and attaches to the session it names.--windowand--panechoose that window and that pane, a ‘%N’ id, on the host once attached.--waitsays ‘vm: press r to connect’ and waits for ‘r’ before the first connect, or ‘q’ to close. Every name goes into the remote shell line quoted, so a session called ‘x'; touch pwned; '’ is a name and nothing else. host killhost session- Kill session on host through
the host command, with every session in its group there, the
‘
api~mac’ sessions other machines' mirrors attach through among them, and close its mirror session here when one is open. One line says how it went: ‘killed api on vm’, ‘api was already gone from vm’, or ‘could not kill api on vm:’ and the reason. host renamehost session new- Rename session on host to
new through the host command, with plain tmux, so
the host's build doesn't matter. The host's daemon moves the grouped
sessions mirrors attach through, and a mirror session open here follows
once the host's list says the new name. One line:
‘
api on vm is now web’, or why not: ‘vm already has a session called web’, ‘api is no longer on vm’. host closehost session- Close the mirror session of session on
host here. The session stays on the host, and so
does every other machine's mirror of it. One line:
‘
closed api@vm here; api stays on vm’, or exit 1 with ‘api@vm isn't open here’. hosts connect[name]- Start or retry a host's link now, or every host's, and say how it went on
one line each: ‘
vm answered: tmux-companion 0.10.0, tmux 3.4’, or the reason it didn't, such as ‘vm needs a login: run ssh vm once in a terminal’. An on-demand link stays up foridle_secsafter the last ask. Exits 1 when any host didn't answer. bridge- Serve the link on stdin and stdout, answering from this machine's daemon and starting it when none runs. This is what a host command runs on the host, not something to type.
Configuration, one table per host:
[[hosts]] name = "vm" command = ["ssh", "vm"] link = "on-demand" poll_secs = 5 idle_secs = 600 connect_secs = 10 ping_secs = 15 open = "mirror" colour = ""
colour is the colour the host's name is
drawn in on every picker row,
‘colourN’ or
‘#rrggbb’. Empty, the default, takes
the next of eight colours in host order, starting at
‘colour203’, so two hosts never share
one until there are more than eight. The name is always in the words as
well, as ‘@vm’, and every row of a
host that can't be reached is dimmed and says
‘unreachable’.
link is when the link is up.
‘on-demand’, the default, starts none
until something asks for the host and closes it
idle_secs after the last ask.
‘while-attached’ keeps it up while any
client is attached to the local tmux server: it is the mode for a host where
agents run long, because an on-demand link hears a host's agents only while
something holds the link up, so a question asked there while you work here
waits until you look. ‘off’ never
starts one; the host is still listed. connect_secs
is how long the host has to say hello, or to answer a question, before the
link is called down. ping_secs is how often a host
that pushes is pinged, and poll_secs how often one
that can't is asked. open is what picking one of the
host's sessions does, in switch sessions, the
project picker and sessions start:
‘mirror’, the default, opens a mirror
session; ‘handover’ hands this
terminal to the host. tmux replaces this terminal's client with the host
command, ‘ssh vm -t 'tmux attach-session -t
=api'’, after saying ‘api on vm,
handed over: detach there to come back to here’ on the message
line, and the terminal says ‘connecting to vm for
api’. The host's tmux then owns the terminal: its bar, its
prefix and its keys, with one bar on the screen and it the host's. This
machine's bar, switch sessions and the rest of its
keys are out of reach until you come back, though the inbox's sounds still
play. A detach on the host comes back with ‘exec
tmux attach-session -t =here’ on this server, to the session
the client left; a connection that ends any other way says so in one line
and waits for Enter before coming back. Outside tmux the attach runs in the
terminal it was typed in, with nothing to come back to.
sessions start --detach
always opens a mirror session, since a handover has to have a client to hand
over, and so do an inbox pick and a host's directory, which chain a pane or
a project onto the attach that only the mirror's attach carries.
COPY MODE AND OPENING
Section titled “COPY MODE AND OPENING”open[text] [-s,-i,-n,-ddir,--paneid,--cursor-xcolumn]- Open what is in the text: a URL goes to a browser, a
‘
path:line:column’ opens an editor there.--cursor-xnames the column the cursor is in, and what sits under it wins. The shipped binding passes the line under the cursor together with ‘#{copy_cursor_x}’, so nothing has to be selected first: being on the thing is the whole gesture, and a line naming two paths opens the one the cursor is actually on rather than whichever came first.-sreads the tmux selection instead of arguments, for a binding that would rather select a range by hand.-i, or--choose, asks which application opens it, from the[[open.application]]list. With nothing in that list there is nothing to choose between, so it opens what it would have opened anyway rather than showing an empty picker.-nprints what it would open and opens nothing.--panenames the pane this is for, and the shipped binding passes ‘#{pane_id}’ so that it does. tmux runs the binding throughrun-shell, whereTMUX_PANEholds the most recently active pane on the server rather than the pane the key was pressed in, so without it the editor can open in a window nobody is looking at. Bound to ‘o’ in copy mode. clipboard- Copy standard input to the system clipboard, whichever command this
platform has. Bound to ‘
y’ in copy mode. shell-initshell- Print the shell code that emits the OSC 133 prompt marks. tmux has had
next-promptandprevious-promptsince 3.3 and they do nothing until the shell says where a prompt begins.On its first prompt the shell sets the pane option ‘eval "$(tmux-companion shell-init zsh)" # or bash tmux-companion shell-init fish | source
@tmux-companion-marks’ to 1, once, inside tmux only.
THEMES
Section titled “THEMES”A theme is a file of tmux options that
_apply.tmux turns into colours. Options are set
without -g, so a theme belongs to one session and
two projects can be different colours at once.
theme init[--themesdir]- Write the starter themes and the two files that apply them. Six colours,
which
theme gen--shadesgrows to 151. Nothing is overwritten. theme gen[--apply] [--shades] [--backgroundcolour]- Compute each theme's readable text colour and a visible border. Without
--applyit reports what would change and touches nothing.--shades[level] writes a theme for every colour in the 6x6x6 cube whose text clears a contrast floor, named after the bundled colour each sits nearest to, so ‘ember-04’ and ‘pine-11’ land together in the picker. level is a rung of a ladder, and the flag on its own means ‘aaa’:aa4.5:1 216 aaa7:1 151 a49.5:1 105 a512:1 75 a6— 18 WCAG names the first two rungs and stops; the rest continue at its own spacing of 2.5 per step, so the ladder is one rule rather than four opinions.
a6is not a floor at all: it is the bundled six with a lighter and a darker sibling of each, which is what--shadesdid before it swept the cube, and the only rung whose colours a person chose.aaais the default rather thanaabecause the worst colour in the cube scores 4.60:1, so an AA filter keeps all 216 of them (a threshold that is arithmetically a no-op). The text colour is chosen to clear 4.5:1 against the theme's own background and the border to clear 3:1 against the terminal's, so a theme that cannot be read cannot be written. theme add--bgcolour [--fgcolour]- A theme from one colour. The text colour is computed unless given, and a
given pair under 4.5:1 is refused without
--force. theme apply[session] [-ttarget,--all]- The theme a session should have, without asking. Run from the
session-createdhook. Silent when there is no theme to apply, which is every install untiltheme inithas run. With[theme]‘default = by-name’ a session nothing claims gets one of the six bundled themes chosen from its name, the same one every time, so every session has a colour of its own with nothing picked.--allrepaints every session instead of one, which is what a reload needs: sourcing tmux.conf resets the global options a theme sets, so without it every session is left wearing whatever the file says rather than its own colour. theme list-colours[--print]- Every colour tmux takes, painted, with its hex and the contrast on it.
--printis one name per line with no swatch, for piping somewhere;--plainis the old spelling and still works.
SOUNDS
Section titled “SOUNDS”A short sound for something a sighted person would see on the bar, for somebody who hears the screen rather than glancing at it.
earconevent- Play the sound event makes,
‘
asked’, ‘done’, ‘health’ or ‘chunk’, now, whether sounds are on or not, and say which command it ran. With[earcons] enabled, the daemon plays them itself: once per pass when agents start waiting on you or finish, and when a health reason appears that was not there before, checked every ten seconds whether or not a bar draws the health mark.[earcons] onsays which events sound, andasked,done,healthandchunkthe command each runs, the platform's own sound when empty. Quiet hours hold them; a health reason that appeared during them sounds when they end.
CONFIGURATION
Section titled “CONFIGURATION”TOML, read from the first of:
TMUX_COMPANION_CONFIG- $XDG_CONFIG_HOME/tmux-companion/config.toml
- ~/.config/tmux-companion/config.toml
- ~/.tmux-companion.toml
Every setting with its default, annotated, is
docs/config.example.toml. The sections are
[general], [dirs],
[git], [network],
[battery], [glyphs],
[status], [sh_jobs],
[usage], [[layout]],
[autoreload],
[window_names], [notify],
[agents], [project],
[autosave], [sessions],
[[restore.program]], [run],
[clipboard], [theme],
[bar], [picker],
[journal], [online],
[open], [earcons],
[chunk], [keys],
[switcher] and [[hosts]]. A
[toggle] section, from a command that has gone, is
ignored, and config check says so.
config path- Which file is being read.
config check- Parse it and say what is wrong, with the line and a suggestion for a misspelled key or an unrecognised value. It also names any setting that still works but is deprecated.
config dump- Every setting with its default, as a config file.
config init[--force]- Write a short starter config where
config pathwould read it, creating the directory, and print the path. The file sets the glyph preset, the directory source and the snapshot timer, and carries the editor-beside-an-agent layout as a comment to uncomment; the rest is left to the defaults, whichconfig dumpprints in full. A file already there is refused unless--force.
Two settings are worth knowing before the rest.
[bar] background is what the segments draw their
caps against and has to match status-style; it used
to be a compiled-in ‘colour233’, which
is one person's bar and nobody else's. [bar] mode is
‘call’, tmux starting a client from
‘#()’ every
status-interval;
‘push’, the daemon setting the session
option ‘@tc-right’ once a second for
status-right to expand without starting anything,
and the same option on each pane whose directory is not its session's, so a
window or pane switch shows the new place at once; or
‘auto’, the default, which pushes when
the global status-right reads
‘@tc-right’ and tmux is 3.4 or newer.
doctor says which it chose and why. After a window
or pane switch the bar follows in tens of milliseconds in either mode, and
push is the sooner of the two: a median of 16 ms against 40 for call on one
idle Intel MacBook. [picker] preview is where every
picker puts its preview pane, or
‘none’ for no preview at all. The rest
of that section is what a picker looks like rather than what it holds:
border, label_position,
hint_position, which the brief, the restore screen,
the run dialog and the cheat sheet follow too, so
‘hidden’ takes the line of keys off
every popup while a restore counting down still says when it goes ahead,
hint_across, which makes that line a row across the
whole popup over the list and the preview both,
prompt_position, list_from,
counter, rules,
marker, column_order and the
preview's own label. Each of them can be written again under
[picker.keys],
[picker.project],
[picker.window],
[picker.theme],
[picker.run], [picker.open],
[picker.panes],
[picker.setup] or
[picker.switch] for the one picker that wants a
different answer, together with the label,
hint and preview_label that
picker says. How big the popup itself is belongs to
display-popup in tmux.conf,
not here. [agents] programs is the one list of what
counts as a coding agent, matched against the name each pane's program was
started as. ‘pane_current_command’ is
matched as it is unless it can hide the program: a bare version (claude,
‘2.1.296’), a release after a hyphen
(grok, ‘grok-1.0.50-mac’), an
interpreter (gemini and cursor-agent are
‘node’, aider
‘python3’) or a name 15 bytes long.
For those the program in front is named from its arguments:
‘argv[0]’ for a native program, the
script for an interpreter, so ‘node
/usr/local/bin/gemini’ is gemini. This reads the process
directly and starts none. When it cannot be read, a bare version still
counts as claude and a name with a release version after a hyphen as the
name before it. The list is read by panes
--agents, the agents segment
and the restore headline alike; waiting_secs is how
long one has to be quiet before it counts as waiting on you, when it has not
said better through agent,
interval_secs how often the bar's segment re-reads
the pane list, and show whether the count after the
total is the agents waiting, the agents busy, or both.
[open] split is which side the editor opens on,
‘right’ or
‘bottom’.
[project] trusted is the paths under which
a checkout's .tmux-companion.toml may run what it
says; see FILES. [project]
dirs_source is where the project picker gets its directories, one of
‘zoxide’,
‘z’,
‘cdr’,
‘ghq’ or
‘none’. zoxide(1) is
the default rather than a requirement, and nothing here has to be installed:
a source that is absent lists nothing, leaving live sessions and whatever is
typed. ‘z’ reads the
~/.z database and
‘cdr’ reads
~/.chpwd-recent-dirs, as files rather than as
commands, because both are shell functions that cannot be run from here.
[project] dirs_command takes any command printing
one absolute path per line, as a list of words, and wins over
dirs_source; [project]
visit_command is what records a pick, defaulting to
‘zoxide add’ for zoxide and nothing
for the rest. [project] zoxide is the old spelling
of ‘dirs_source = "none"’
and goes away in the next release.
[[git.branch_types]] is the glyph drawn
before a branch name, keyed on how the name starts. Each entry is an
icon and a list of prefixes,
tried in the order written; the first prefix that claims the name wins, and
it is cut off the name the bar draws, so
‘feat/status-bar’ renders as the
feature glyph and ‘status-bar’.
Prefixes are compared without regard to case and are plain text rather than
regular expressions. icon takes
‘{NAME}’ for any glyph the tool knows,
so the file stays readable without a patched font, and draws anything else
as written. Twenty-five groups ship, from
‘feat/’ and
‘fix/’ to
‘docs/’,
‘perf/’,
‘parked/’ and
‘a11y/’; config
dump prints them in the shape they are edited in. The list adds to
them rather than replacing them: its entries are tried first, then every
shipped entry it does not repeat, so an entry wins for the prefixes it names
and every other prefix keeps its glyph. An empty
icon claims its prefixes for the plain branch glyph
and keeps the name whole, which is how a shipped entry is turned off. A name
with no ‘word/’ prefix keeps the plain
branch glyph, which is why ‘main’ and
‘master’ need no entry.
A ‘word/’ prefix nothing in
the list claims is looked up among the Nerd Font Material Design glyph names
built into the binary: the word as written, then as a singular, then from
‘-ed’ or
‘-ing’, then as a plural, skipping any
glyph the bar already draws for something else, so
‘cleanup/’ finds the broom. The daemon
keeps each pick in
$XDG_STATE_HOME/tmux-companion/branch-icons.toml so
the same prefix draws the same glyph after a restart or an upgrade;
doctor lists the picks with the
icon value that makes one an entry of your own. A
prefix the lookup cannot place draws a catch-all glyph with the name whole.
[git] branch_icon_matching = false turns the lookup
off, and so does the ascii glyph preset, since a looked-up glyph has no
7-bit form.
DIAGNOSTICS
Section titled “DIAGNOSTICS”doctor- What a bug report needs: the version, the socket, what the config says,
the last line of the daemon log, whether either autosave is running and
when it last did, every reason the health mark would show, what tmux says,
and what is missing. A daemon from another build, one that does not
answer, and a config file edited after the daemon started each end their
line with ‘
run tmux-companion restart’, because that is the answer to all three. The report ends on tmux's own options, the ones that cost something as they are set: an ‘escape-time’ over 50 ms, a ‘history-limit’ of 2000 lines or under, a ‘display-time’ under two seconds, a ‘status-interval’ over five or of zero, ‘focus-events’, ‘set-clipboard’, ‘monitor-bell’ or ‘mouse’ turned off, a ‘default-terminal’ with no 256 colours in its name, and, with hosts configured, a ‘set-clipboard’ other than ‘on’, which keeps a copy made in a mirror session on the host. Each gets the value it has, what that costs, and the line for tmux.conf under it. Nothing is set: the file is yours, and ‘mouse’ for one is a preference. A tmux with nothing to change says so in one line. Most people got these settings from tmux-sensible, which set them as a plugin and hasn't been pushed since April 2024. The ‘setup’ line counts the itemssetuplists as open, and the ‘hosts’ line says whathostssays about each host, from a daemon already running. health[ack]- Why the health mark is up, one reason a line, or
‘
ok’. A timer or a segment that failed stays a reason for an hour, until the same timer runs and works, or untilhealth ackforgets it, whichever comes first;ackprints each failure it forgot. It forgets failures and unclean stops and nothing else. A config.toml edited after the daemon started, a newer binary on disk, quiet hours and a network that's gone are how things are, so they stay, andacklists them under what it forgot as ‘still on the mark’. The sessions timer finding no tmux server, or a server with no session in it, isn't a failure and is never a reason: every session closed is something people do, and the daemon is still there when tmux comes back. health notesource text ... [--ttlduration]health notesource--clear- Put a reason on the mark from outside the daemon: a dotfiles check, a
build, anything that wants the bar to say something until it is fixed. It
is said as ‘
source: text’, or as the text alone when it already starts with ‘source:’, after the daemon's own reasons, inhealth,briefand behind the bar's health mark. source is letters, digits, ‘-’, ‘_’ and ‘.’, up to 32, and each source has one note: saying it again replaces it in place, so a check that runs daily keeps one line. The words of text are joined with spaces into one line of up to 120 characters.--ttltakes it away after duration, ‘90m’, ‘12h’ or ‘2d’, unless it is said again first, for a source that might stop running; without it a note lasts until--clear.health ackleaves notes standing, since their source says when they stop being true. Notes are kept in $XDG_STATE_HOME/tmux-companion/health-notes.json and read back when the daemon starts. On another machine's mirror bar a host's note is part of that host's own health segment. One line says what happened: ‘noted dotfiles: 3 drifted’, ‘cleared dotfiles's note’ or ‘dotfiles had no note’. probe- What the terminal answers about itself.
- ~/.config/tmux-companion/config.toml
- the configuration
- .tmux-companion.toml
- in a project root, the layout that checkout opens with:
[[window]]rows in the shape of[[layout.window]], orlayoutnaming one of the reader's own; its commands run only under a path[project] trustedlists, and elsewhere the names alone are taken.config checkrun inside the checkout reads it too - ~/.config/tmux/themes/
- themes, and the two files that apply them
- ~/Library/DoNotDisturb/DB/
- macOS's Focus database, read and never written, with
[quiet] follow_focus - $XDG_CONFIG_HOME/dconf/user
- GNOME's settings database, read and never written, on Linux with
[quiet] follow_focus - $XDG_STATE_HOME/tmux-companion/projects/
- saved per-project layouts
- $XDG_STATE_HOME/tmux-companion/hosts/
- each host's last answer, <name>.bin, kept so a host is listed before its link is up
- $XDG_STATE_HOME/tmux-companion/health-notes.json
- the reasons
health noteput on the mark, one per source, kept across a daemon restart - $XDG_STATE_HOME/tmux-companion/branch-icons.toml
- the glyph the daemon picked for each branch prefix it looked up by glyph name; delete it and restart the daemon to pick again
- $XDG_CONFIG_HOME/tmux-companion/keys.toml
- the
[keys]settings and tables, without the ‘keys.’ prefix, beside the config file; both files count, and a name set in both is an error - $XDG_STATE_HOME/tmux-companion/keys-discovered.json
- what
keys discoverfound in each layer, read bykeys collide - $XDG_STATE_HOME/tmux-companion/keys-route.tmux
- the script the last
keys routesourced, kept for reading when a wrapper misbehaves - $XDG_STATE_HOME/tmux-companion/crashes.tsv
- one line for every time the daemon started and found that the one before
it had stopped without cleaning up, a crash or a
‘
kill -9’: the unix time it noticed, and the last heartbeat the old one wrote. Two lines within a minute put a second reason on the health mark - $XDG_STATE_HOME/tmux-companion/keys-usage.tsv
- which bindings the key picker ran, written only with
[usage] enabledon: one table key @secs line per pick, the time in unix seconds, until it passes five thousand lines, then one table key count first last line per binding under a ‘#v2’ header. A log written before picks had a time, raw or under ‘#v1’, is still read - $XDG_STATE_HOME/tmux-companion/VERSION
- the build that last started a daemon here, rewritten on every start
- $XDG_STATE_HOME/tmux-companion/sessions/running
- the pid of the running daemon, written at start and removed by a clean
stop, which includes
SIGTERMandSIGINT - $XDG_STATE_HOME/tmux-companion/sessions/crashed
- the running file of a daemon that never removed
it, moved here by the next daemon to start once it has found that pid
dead; its presence is what makes
sessions resurrecttreat the last snapshot as taken before a crash - $XDG_STATE_HOME/tmux-companion/setup-skipped.tsv
- the ids
setupwas told to skip, one per line - $XDG_STATE_HOME/tmux-companion/build-seen
- the build a daemon first ran here and when, tab-separated
- $XDG_STATE_HOME/tmux-companion/journal.tsv
- what ran long, what the agents asked, what opened and closed
- $XDG_STATE_HOME/tmux-companion/daemon.log
- the daemon's stderr: one line per start, one per failure, unless
[general] logpoints elsewhere - /tmp/tmux-companion-$UID.sock
- the daemon's socket
- /tmp/tmux-companion-$UID.sock.lock
- the lock one daemon holds for the life of the process, so a second start cannot unlink the socket out from under the first
- ~/.z
- the z database, read when
[project] dirs_sourceis ‘z’ - ~/.chpwd-recent-dirs
- zsh's recent directories, read when
[project] dirs_sourceis ‘cdr’
ENVIRONMENT
Section titled “ENVIRONMENT”TMUX_COMPANION_CONFIG- a configuration file, before the search order
TMUX_COMPANION_SOCK- the daemon socket, before the default. A client replaces a daemon from an older build and leaves a newer one alone, saying so once, so a development build run beside the installed one wants a socket of its own here rather than the two taking turns replacing each other's daemon
TMUX_COMPANION_TRACE- a file each process appends timing marks to, one line per mark: its pid,
what happened (
main,chrome,rows,paint,drawn,key,tmux) and the wall-clock time. scripts/bench-capped.sh reads it to split a picker's opening into phases and to count the tmux processes the daemon starts; unset, nothing is written TMUX_COMPANION_TMUX_CONF- the tmux configuration the daemon watches for key bindings and
[autoreload], before the first of $XDG_CONFIG_HOME/tmux/tmux.conf and ~/.tmux.conf that exists XDG_CONFIG_HOME,XDG_STATE_HOME- where configuration and state live
_Z_DATA- the z database, before ~/.z
ZDOTDIR- where zsh keeps .chpwd-recent-dirs, before the home directory
EXIT STATUS
Section titled “EXIT STATUS”The tmux-companion utility exits 0
on success, and >0 if an error occurs.
A binding that runs from run-shell prints
its complaint on standard output rather than exiting non-zero, because tmux
turns a non-zero exit into ‘'tmux-companion open -s'
returned 1’ in the message area, which names the command and
not the problem.
SEE ALSO
Section titled “SEE ALSO”AUTHORS
Section titled “AUTHORS”Yogesh Lonkar
| September 26, 2026 | Debian |