zsh-tmux

April 28, 2026 · View on GitHub

Automatic tmux window title management for Zsh — live updates as commands run.

License: MIT CI

Know at a glance what every pane is doing. zsh-tmux hooks into Zsh's precmd and preexec to keep your tmux window titles in sync — idle panes show zsh, running panes show the command name, and job references like fg resolve to the actual process.

Requirements

macOS (Homebrew):

brew install tmux

Nix:

nix profile install nixpkgs#tmux

Installation

Using zinit

zinit load zsh-contrib/zsh-tmux

Using sheldon

[plugins.zsh-tmux]
github = "zsh-contrib/zsh-tmux"

Manual

git clone https://github.com/zsh-contrib/zsh-tmux.git ~/.zsh/plugins/zsh-tmux
source ~/.zsh/plugins/zsh-tmux/zsh-tmux.plugin.zsh

Behavior

StateWindow Title
Idle at promptzsh
Running vim file.txtvim
Running npm run buildnpm
Long command nameTruncated with ...

Titles are capped at 20 characters and have newlines stripped and percent signs escaped.

Outside tmux: the plugin falls back to OSC 0 (ESC ] 0 ; <title> BEL), the xterm-standard window-title sequence supported by Ghostty, Kitty, iTerm2, Apple Terminal, Alacritty, WezTerm, etc. — so non-tmux users get live window titles too.

On TERM=dumb / pipes / non-interactive shells: no escape is emitted.

Configuration

Conditional Loading

Only load when inside tmux:

if [[ -n "$TMUX" ]]; then
  zinit load zsh-contrib/zsh-tmux
fi

Disabling titles entirely

Set ZSH_TMUX_DISABLE_TITLE=1 before the plugin is sourced (or any time before update_title runs) to suppress all title updates — useful when another plugin or your prompt is already managing the window title.

export ZSH_TMUX_DISABLE_TITLE=1

Tmux Configuration

Ensure tmux is configured to display window titles:

# ~/.tmux.conf
set -g set-titles on
set -g set-titles-string "#W"

API Reference

update_title <title>

Sets the tmux window title with automatic truncation.

update_title "vim"
update_title "very-long-command-name"  # shows: "very-long-comman..."

Hook Functions

Registered automatically — do not call directly.

HookTriggerAction
_zsh_title__precmdBefore each promptSets title to zsh
_zsh_title__preexecBefore command executionSets title to command name

_zsh_title__preexec extracts the first word of the command and resolves job references (fg, %1, %+) to the actual command text.

The zsh-contrib Ecosystem

RepoWhat it provides
zsh-awsAWS credential management with aws-vault and tmux
zsh-ezaeza with Catppuccin and Rose Pine theming
zsh-fzffzf with Catppuccin and Rose Pine theming
zsh-op1Password CLI with secure caching and SSH key management
zsh-tmux ← you are hereAutomatic tmux window title management
zsh-vividvivid LS_COLORS generation with theme support

License

MIT — Copyright (c) 2025 zsh-contrib