tmux
Topics: Linux Shell
tmux is a terminal multiplexer that allows to manage sessions with multiple shell windows.
Keybinds
This section lists important default keybindings.
- Copy mode:
<leader>[ - Split vertically:
<leader>% - Split horizontally:
<leader>"
Layout
<leader> Ctrl+o: Toggle through layouts<leader> M-1: Switch to layout 1 (layout 2, 3, 4 analogous)
Sharing tmux sessions
See tmate.
vi copy mode
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel “reattach-to-user-namespace pbcopy”
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection
SSH directly into tmux
if [[ -n "$SSH_TTY" ]]; then
export TMPDIR=$HOME/tmp
sname="ssh-$(hostname | cut -d. -f1)"
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
exec tmux new-session -A -s $sname
fi
fi
Bookmarks
- Official tmux wiki
- Curly underline support
- tmux plugin manager
- How To Use and Configure Tmux Alongside Neovim
- tmux cheat sheet