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 thems or employ a plugin manager. Tpm is designed for this purpose, which helps to manage your 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

  1. Add new plugin to ~/.tmux.conf with set -g @plugin '...'

  2. Press <prefix> + I0 to fetch the plugin.

plugin update

Press <prefix> + U to update existing plugins

plugin uninstall

  1. Delete or comment out the plugin in .tmux.conf

  2. Press <prefix> + alt + u to remove the plugin

Automatic install of tpm on new machines

Accordingt to 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'"

Plugin 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 manully.

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.