tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
Features #
- Popup windows - Quick access to sessions and tools without leaving current context
- Session management - Easy switching between projects
- Vi mode - Familiar keybindings for copy mode
- Minimal status bar - Hidden by default, toggle when needed
Setup #
Installation #
Install via mise:
mise install tmux
Or your package manager:
# Ubuntu/Debian
sudo apt install tmux
# Arch Linux
sudo pacman -S tmux
Configuration #
The config file is ~/.tmux.conf. Main settings:
# Vi mode for copy/paste
setw -g mode-keys vi
# Don't detach on destroy
set-option -g detach-on-destroy off
# Focus events for nvim integration
set-option -g focus-events on
# Hidden status bar by default
set-option -g status off
Key Bindings #
Prefix #
The prefix key is Ctrl+Space (custom):
bind Space send-prefix
Session Management #
| Key | Action |
|---|---|
Alt+Space |
Popup: attach to workspace session |
Alt+T |
Popup: attach to workspace in current directory |
Alt+Escape |
Popup: create new workspace |
Alt+Backspace |
Popup: add repo to workspace |
Ctrl+J |
Popup: switch to any session with fzf |
Alt+G |
Popup: open scratch session |
Alt+Shift+G |
Popup: open scratch session (large) |
Ctrl+K |
Popup: kill sessions |
J |
tmux session tree browser |
Copy Mode #
| Key | Action |
|---|---|
Alt+[ |
Enter copy mode |
Alt+V |
Enter copy mode |
Alt+Enter |
Enter copy mode |
Enter |
Enter copy mode |
Copy uses wl-copy on Wayland or xclip on X11.
Status Bar #
| Key | Action |
|---|---|
Prefix+s |
Toggle status bar |
Prefix+Ctrl+S |
Toggle status bar |
Git Integration #
| Key | Action |
|---|---|
Alt+F |
Popup: git commit --verbose |
Alt+Shift+F |
Popup: gitui |
Workspaces #
| Key | Action |
|---|---|
Ctrl+W |
Popup: attach to ~/work |
Alt+W |
Popup: attach to ~/work |
Ctrl+G |
Popup: attach to ~/git |
Ctrl+P |
Popup: attach to ~/project |
Ctrl+T |
New session: todo list in nvim |
Popup Windows #
Popups are a key feature - they let you access tools without leaving your current context:
# Example: switch sessions without leaving current window
bind C-j display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' \\
--bind 'enter:execute(tmux switch-client -t {})+accept'"
Workflows #
Project Hopping #
Alt+Spaceto see all workspace sessionsCtrl+Jto fuzzy-find any sessionAlt+Gfor a quick scratch pad
Git Workflow #
Alt+Fto write a commit message in a popupAlt+Shift+Ffor full gitui when needed
Todo Management #
Ctrl+Topens a dedicated todo session with three files:backlog.md- Things to do eventuallydoing.md- Currently working ondone.md- Completed tasks
Clipboard Integration #
Copy mode automatically integrates with system clipboard:
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel \\
"bash -c 'command -v wl-copy >/dev/null && wl-copy || \\
xclip -i -f -selection primary | xclip -i -selection clipboard'"