Install tmux plugins using the Tmux Plugin Manager (TPM). First, clone TPM: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
. Add plugins to ~/.tmux.conf
. Install plugins with Ctrl+b I and update with Ctrl+b U.
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
Tmux plugins extend the functionality of tmux with features like session saving, battery status indicators, CPU usage displays, and much more. The Tmux Plugin Manager (TPM) makes it easy to install and manage plugins.
# Clone TPM repository git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm # Add TPM to your tmux configuration echo "# List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'" >> ~/.tmux.conf
After setting up TPM, you can use these keybindings:
Saves and restores tmux sessions across system restarts.
set -g @plugin 'tmux-plugins/tmux-resurrect'
Usage: Ctrl+b Ctrl+s to save, Ctrl+b Ctrl+r to restore.
Automatically saves sessions and restores them when tmux starts.
set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' # Enable automatic restore
Enhances tmux search with predefined searches and highlights.
set -g @plugin 'tmux-plugins/tmux-copycat'
Usage: Ctrl+b / for regex search, Ctrl+b Ctrl+f for file search.
Enables copying to system clipboard from tmux.
set -g @plugin 'tmux-plugins/tmux-yank'
# List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-battery' set -g @plugin 'tmux-plugins/tmux-cpu' # Plugin configuration set -g @continuum-restore 'on' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-strategy-vim 'session' set -g @resurrect-strategy-nvim 'session' # Status bar integration example for battery and CPU plugins set -g status-right 'CPU: #{cpu_percentage} | Battery: #{battery_percentage} | %a %h-%d %H:%M ' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'
For the best experience with plugins, create a consistent setup across machines by versioning your tmux configuration files. Consider using a dotfiles repository with your tmux configuration to easily set up new machines.
# Install and sync your dotfiles git clone https://github.com/yourusername/dotfiles.git ~/.dotfiles cd ~/.dotfiles ./install.sh # Your script to symlink configs