Skip to content

Instantly share code, notes, and snippets.

@priancho
Last active June 28, 2022 09:30
Show Gist options
  • Save priancho/b8c0fa2dfe5716401ebf9c53d7b6f0fc to your computer and use it in GitHub Desktop.
Save priancho/b8c0fa2dfe5716401ebf9c53d7b6f0fc to your computer and use it in GitHub Desktop.
###########################
### Reference Web-pages ###
###########################
#
# Best reference:
# https://gist.github.com/MohamedAlaa/2961058
# http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily
# https://gist.github.com/spicycode/1229612
#
# Pre-requisites:
# - Install TPM
# - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
#
set-option -g default-shell "/bin/bash"
######################
### DESIGN CHANGES ###
######################
set -g default-terminal "screen-256color"
# activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# stop renaming windows
set-option -g allow-rename off
# panes
set -g -u pane-border-style
set -g -u pane-active-border-style
# status line
# set -g status-utf8 on
set -g status 'on'
set -g status-justify left
set -g status-bg black
set -g status-fg green
set -g status-interval 2
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[bg=cyan]#[fg=black] #I #[bg=white]#[fg=black] #W "
setw -g window-status-current-format "#[bg=black]#[fg=red] #I #[bg=white]#[fg=black] #W "
setw -g window-status-current-style bg=colour0
setw -g window-status-current-style fg=colour11
setw -g window-status-current-style dim
setw -g window-status-style bg=green
setw -g window-status-style fg=black
setw -g window-status-style reverse
# set window index start from 1
set -g base-index 1
#######################
### KEY RE-BINDINGS ###
#######################
# remap prefix from 'C-a' to 'C-t'
unbind C-b
set -g prefix C-t
bind-key C-t send-prefix
# reload tmux config: C-r
bind r source-file ~/.tmux.conf \; display 'Config reloaded'
# vi key-binding
set-window-option -g mode-keys vi
# session switching with Alt + up/down arrow
bind -n M-Up switch-client -p
bind -n M-Down switch-client -n
# window switching with Alt + left/right arrow
bind -n M-Left previous-window
bind -n M-Right next-window
# split panes using | and -
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
# switch panes with Shift + arrow
bind -n S-Left select-pane -L
bind -n S-Right select-pane -R
bind -n S-Up select-pane -U
bind -n S-Down select-pane -D
# resize panes with Ctrl + Shift + arrow
bind -n C-S-Left resize-pane -L
bind -n C-S-Right resize-pane -R
bind -n C-S-Up resize-pane -U
bind -n C-S-Down resize-pane -D
# function key bindings
bind -n F2 new-window
# send a command to all panes (turn on/off)
bind e setw synchronize-panes
####################
### tmux Plugins ###
####################
# List of plugins
# use <tmux control> + I to install plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# tmux session autosave and restoration
# * https://andrewjamesjohnson.com/restoring-tmux-sessions/
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
@priancho
Copy link
Author

My tmux configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment