tmuxsheet - feliyur/exercises GitHub Wiki

Tmux terms: each machine can run multiple tmux sessions. Each session can have multiple windows ("tabs"). Each window can be split to multiple panes.

Commands

Prefix is usually Ctrl+b (or sometimes Ctrl+a).

Command Effect
tmux create new tmux session
prefix + d Detach from session
tmux ls list existing sessions (recommendation: alias tls=tmux ls)
tmux attach-session -t <session id> attach to existing session (recommendation: alias ta=tmux attach-session -t)
prefix + %, prefix + " Horizontal, vertical split pane
prefix + , , , Switch to a different pane.
prefix + c New window
prefix + n / p / [number] Switch to next/previous/[number] window.
prefix + [ Switch to scroll mode (exit using q)
prefix + q Show pane numbers.
prefix + space Swap layout of panes (horizontal <==> vertical)
prefix + x Close / kill pane (kill-pane command).
prefix + , Rename window.
prefix + & Kill window.
prefix + D (capital) Shows a list to choose which simultaneously attached client to detach.
kill-session [-t id] Take a wild guess ;)
prefix + ! Break pane into a new window.

Some commands starting with prefix can be run from the terminal replacing prefix with tmux.

tmux plugin manager

https://github.com/tmux-plugins/tpm

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Put this at the bottom of ~/.tmux.conf ($XDG_CONFIG_HOME/tmux/tmux.conf works too):

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

Reload TMUX environment so TPM is sourced:

# type this in terminal if tmux is already running
$ tmux source ~/.tmux.conf

tmux-resurrect:

depends on tmux plugin manager

https://github.com/tmux-plugins/tmux-resurrect

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'tmux-plugins/tmux-resurrect'

Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.

⚠️ **GitHub.com Fallback** ⚠️