Skip to content

Instantly share code, notes, and snippets.

@kl
Last active February 21, 2020 08:37
Show Gist options
  • Save kl/7335579 to your computer and use it in GitHub Desktop.
Save kl/7335579 to your computer and use it in GitHub Desktop.
tmux.conf
# Enable 256 color mode
set -g default-terminal "screen-256color"
# Disable mouse
set -g mouse off
# Set the prefix from C-b to C-a
set -g prefix C-a
unbind C-b
# Reduce the input lag
set -s escape-time 1
# Set the base index for windows and panes to 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Reload this config file
bind r source ~/.tmux.conf \; display "Reloaded!"
# Press C-a twice to send C-a to the application
bind C-a send-prefix
# Splitting panes with | and -
bind | split-window -h
bind - split-window -v
# Moving between panes with Prefix h,j,k,l,y,u,b,n
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind y select-pane -L \; select-pane -U
bind u select-pane -R \; select-pane -U
bind b select-pane -L \; select-pane -D
bind n select-pane -R \; select-pane -D
# Quick window selection (-r = repeatable)
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Resize panes with Prefix H,J,K,L
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
### VISUAL STYLING ###
# Set the status line's colors
set -g status-style fg=white,bg=black
# Set the color of the window list
setw -g window-status-style fg=white,bg=black
# Set the color of the active window
setw -g window-status-current-style fg=black,bold,bg=colour213
# Command / message line
set -g message-style fg=white,bold,bg=black
### STATUS LINE ###
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan] %y-%m-%d %H:%M"
set -g status-justify centre
# Highlight status line window when there is activity in other window
setw -g monitor-activity on
# Set status activity styling
setw -g window-status-activity-style fg=cyan
### COPY MODE ###
# Enable vi copy mode
set -g mode-keys vi
# Prefix Esc enters copy mode
unbind [
bind Escape copy-mode
unbind p
# v to enter selection mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
# y to yank
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard"
# p to paste
bind p paste-buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment