tmux Cheatsheet
Plugins
Use this tmux reference while you build software engineering projects, review code, or refresh the syntax you reach for most.
Plugins (TPM)
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# at the bottom of ~/.tmux.conf set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'christoomey/vim-tmux-navigator' set -g @continuum-restore 'on' set -g @resurrect-strategy-vim 'session' run '~/.tmux/plugins/tpm/tpm'
| Keys | TPM action |
|---|---|
prefix I | Install new plugins |
prefix U | Update plugins |
prefix M-u | Remove plugins no longer listed |
| Plugin | Adds |
|---|---|
tmux-sensible | Sane defaults everyone ends up setting |
tmux-resurrect | Save and restore sessions across reboots (prefix Ctrl-s, prefix Ctrl-r) |
tmux-continuum | Automatic periodic saving for resurrect |
vim-tmux-navigator | One set of Ctrl-hjkl keys for Vim splits and tmux panes |
tmux-yank | Clipboard integration that just works per platform |
tmux-fzf | Fuzzy find sessions, windows, panes |
Installing Without TPM
TPM is convenient but it is only a git clone plus a run-shell line. Doing it by hand is fine, and it is what you want on a server where you would rather not add a plugin manager.
mkdir -p ~/.tmux/plugins git clone https://github.com/tmux-plugins/tmux-resurrect ~/.tmux/plugins/tmux-resurrect
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
Order matters: run-shell lines and the run '…/tpm' line go at the bottom of the config, after your own set and bind lines, so your settings win where they overlap.
tmux-sensible
Worth reading rather than just installing, because it is a short list of the defaults nearly everyone converges on.
set -s escape-time 0 set -g history-limit 50000 set -g display-time 4000 set -g status-interval 5 set -g default-terminal "screen-256color" set -g focus-events on setw -g aggressive-resize on bind C-p previous-window bind C-n next-window
If you set these yourself, you do not need the plugin.
Resurrect and Continuum
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-strategy-nvim 'session' set -g @resurrect-processes 'ssh psql "~rails server" "npm run dev"' set -g @continuum-restore 'on' set -g @continuum-save-interval '15' set -g @continuum-boot 'on'
| Option | Does |
|---|---|
@resurrect-processes | An allowlist of commands to restart, not just the shell |
@resurrect-capture-pane-contents | Save scrollback too |
@resurrect-strategy-vim / -nvim | Restore the editor's own session file |
@continuum-restore | Restore automatically when the server starts |
@continuum-save-interval | Minutes between automatic saves, 0 disables |
Saved state lives in ~/.local/share/tmux/resurrect/, as plain text files you can inspect.
Plugin Troubleshooting
| Symptom | Cause |
|---|---|
prefix I does nothing | The run '~/.tmux/plugins/tpm/tpm' line is missing or not last |
| A plugin's bindings are ignored | Your own bind came after it, or vice versa. Check list-keys. |
| Config errors after adding a plugin | tmux stops reading the file at the first error. Fix that line. |
| Plugin works locally, not on a server | The clone did not happen there. Plugins are not synced by your dotfiles unless you vendor them. |
tmux list-keys | grep -i resurrect
ls ~/.tmux/plugins
tmux source-file ~/.tmux.conf