In this post, I want to share how to manage tmux plugins with Tmux plugin manager (i.e., tpm) and also mention a few useful plugins.
Install the plugin manager#
Like Vim, to add new tmux plugins, we can either manually install them or employ a plugin manager. Tpm is designed for this purpose, which helps to manage our plugins automatically.
Install tpm#
First, we need to install tpm itself:
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
Add the following setting to your tmux configuration file .tmux.conf
:
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# .... maybe more plugins here
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
Then you should refresh the tmux environment to make the change take effect:
tmux source ~/.tmux.conf
Plugin management with tpm#
The following operations assume that you are in a tmux session.
plugin install#
Add new plugin to
~/.tmux.conf
withset -g @plugin '...'
Press
<prefix> + I
1 (capital I) to fetch the plugin.
plugin update#
Press <prefix> + U
to update existing plugins
plugin uninstall#
Delete or comment out the plugin line in
.tmux.conf
Press
<prefix> + alt + u
to remove the plugin
Automatic install of tpm on new machines#
According to doc here,
to automatically install tpm on a new machine, you can add the following
setting to your .tmux.conf
:
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
Plugins to Install#
Themes#
Themes are great. Here are a few themes you can try.
Tmux theme pack#
Tmux theme pack is a collection of themes.
Install it with tpm (add the following setting to .tmux.conf
):
set -g @plugin 'jimeh/tmux-themepack'
Pick a theme:
set -g @themepack 'powerline/block/cyan'
tmux-colors-solarized#
tmux-colors-solarized is a solarized color theme for tmux.
Install it with tpm:
set -g @plugin 'seebi/tmux-colors-solarized'
Four themes are provided: 256
, dark
, light
and base16
. You can choose
one via .tmux.conf
option:
set -g @colors-solarized '256'
# set -g @colors-solarized 'dark'
# set -g @colors-solarized 'light'
# set -g @colors-solarized 'base16'
tmux-resurrect#
Tmux-resurrect let you easily restore all your tmux session after a system restart so that you do not need to do it manually.
Install it with tpm:
set -g @plugin 'tmux-plugins/tmux-resurrect'
key bindings#
It provides two key bindings for save and restore your tmux environment:
- Save:
<prefix> + Ctrl-s
- Restore:
<prefix> + Ctrl-r
For more plugins, you can find them here and here.
<prefix>
is your prefix key for tmux ↩︎