本文最后更新于 649 天前,其中的信息可能已经有所发展或是发生改变。
Installing tmux
Platform | Install Command |
---|---|
Debian or Ubuntu | apt install tmux |
macOS (using Homebrew) | brew install tmux |
Useful cmd / shortcut
Cmd | Shortcut | Description |
---|---|---|
man tmux | Show tmux documentation | |
tmux new -s [Session Name] | Create a new tmux session | |
tmux a -t [Session Name] | Attach to an existing session | |
tmux detach | prefix + d | Detach current session |
tmux kill-session -t [Session Name] | Delete a specific Session | |
prefix + r | Source the .tmux.conf file | |
prefix + , | Rename current active window | |
prefix + c | Create new window | |
prefix + & | Kill current window | |
prefix + n | Next window | |
prefix + p | Previous window | |
prefix + w | List all Sessions and windows | |
prefix + | | Split windows left and right | |
prefix + - | Split windows up and down | |
Ctrl + h/j/k/l | Move to the left/down/up/right pane, enabled by vim-tmux-navigator | |
prefix + h/j/k/l | Resize pane, direction keys can be repeated | |
prefix + m | Maximize/Unmaximize current pane |
Personal configuration
All key remappings and options setting go into~/.tmux.conf
(Remeber to source the config file after you make changes)
My prefix key is Ctrl-a
$ touch ~/.tmux.conf
$ tmux source ~/.tmux.conf # run this line after you make changes
Plugins
Install tpm
First, we will clone tpm into ~/.tmux folder under the home folder
$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Otherwise you may get "~/.tmux/plugins/tpm/tpm' returned 127" by executing the following steps
Installing Plugins
- Add new plugin to
~/.tmux.conf
withset -g @plugin '...'
- Make sure
run -b '~/.tmux/plugins/tpm/tpm'
is at the bottom of your .tmux.conf - Press
prefix
+ I (capital i, as in Install) to fetch the plugin. (default prefix is ctrl+b)
Uninstalling Plugins
- Remove (or comment out) plugin from the list.
- Press
prefix
+ alt + u (lowercase u as in uninstall) to remove the plugin. Or you can manually delete the plugins stored in~/.tmux/plugins/