Last updated: 2024-07-16 Tue 12:38

tmux

Table of Contents

Install

$ sudo aptitude install tmux

Configure ~/.tmux.conf

# See default configurations by doing 'tmux show -g' inside tmux
# See default key bindings by pressing 'C-b ?'
# To test changes to ~/.tmux.conf, do inside tmux session 'tmux source-file ~/.tmux.conf'

# Configurations
set -g default-terminal "screen-256color" # Support full color palette

set -g base-index 1                     # tmux indexes windows from 0. Start from 1.
setw -g pane-base-index 1

# Custom key bindings
unbind C-b                              # Change prefix key C-b to C-a (as in screen)
set-option -g prefix C-a
bind-key C-a send-prefix

# Default key bindings (most used)      # Press prefix C-a first. 
bind-key          % split-window -h     # Split window vertically
bind-key          '"' split-window      # Split window horizontally
bind-key -r      Up select-pane -U      # Select top pane
bind-key -r    Down select-pane -D      # Select bottom pane
bind-key -r    Left select-pane -L      # Select left pane
bind-key -r   Right select-pane -R      # Select right pane
bind-key -r    M-Up resize-pane -U 5    # Resize pane
bind-key -r  M-Down resize-pane -D 5    # Resize pane
bind-key -r  M-Left resize-pane -L 5    # Resize pane
bind-key -r M-Right resize-pane -R 5    # Resize pane
bind-key        C-o rotate-window       # Switch two panes
bind-key          c new-window          # Create new window (exit it by doing 'exit')
bind-key          n next-window         # Next window
bind-key          p previous-window     # Previous window

DONE Tmux Plugin Manager

Tmux functionalities can be broadened with plugins. Plugins can be installed either manually or with Tmux Plugin Manager.

Install Tmux Plugin Manager by doing:

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

Then add the following at the bottom of ~/.tmux.conf:

# Tmux Plugin Manager
set -g @plugin 'tmux-plugins/tpm'

# Tmux-sensible settings
set -g @plugin 'tmux-plugins/tmux-sensible'

# Theme for Tmux
set -g @plugin 'sei40kr/tmux-airline-dracula'

# Run Tpm
run -b '~/.tmux/plugins/tpm/tpm'

So that the tmux-airline-dracula theme would work, add powerline font:

$ sudo aptitude install fonts-powerline

Rebuild font-cache file: $ fc-cache -fv

Plugins are installed with Ctrl-a i, and updated with Ctrl-a u.

Tuomas Pyyhtiä / CC BY-SA NVim 0.9.5 (nvim-orgmode 0.3.4)