Tmux - the terminal multiplexer.
Tmux has a few concepts anyone should be familiar with:
- session
- connection to the windows you’re working with
- window
- single screen you’re working with
- pane
- part of window - “split”
Tmux can also run multiple servers on one machine. with
tmux -L <server_name>.
Some commands
All shortcuts do assume default Tmux leader - C-b.
| Shortcut | Command | Explanation |
|---|---|---|
| C-b : | Enter tmux command prompt | |
| C-b , | :rename-window | |
| C-b ! | :break-pane | push it to new window |
| C-b j | :join-pane <to-pane-nr> | join pane to current window |
| C-b . | change pane number | |
| C-b $ | :rename-session […] | |
| C-b { | Swap active pane with above | |
| C-b } | Swap active pane with below | |
| C-b w | Choose a window from a list | |
| C-b ? | Show those bindings | |
| C-b d | detach form current session | |
| - | tmux ls | list sessions |
| - | tmux attach [sessionId] | attach to existing session |
| - | :set synchronized-panes | Synchronize input in all visible panes |
| C-b m | Toggle marked pane - remove/add ugly bar | |
| C-b [ | Enter caret mode (begin selection for copy) | |
| C-b ] | Paste copied via tmux |
Minimal config
We can test it with running tmux -L my-test-server -f <file-with-alternate-config>
set -g mouse on
set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "xterm-256color"
setw -g mode-keys vi
unbind-key -T copy-mode-vi v
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' # Yank selection to system clipboard (only use if you have xclip installed).
# bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode - mac / non xorg.
Comments