Skip to content

Instantly share code, notes, and snippets.

@brandenbyers
Created February 5, 2015 21:38
Show Gist options
  • Save brandenbyers/35ddc1c5d56234c1ca4f to your computer and use it in GitHub Desktop.
Save brandenbyers/35ddc1c5d56234c1ca4f to your computer and use it in GitHub Desktop.
# improve colors
set -g default-terminal 'screen-256color'
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Speed up ESC
set -sg escape-time 0
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# reload configuration
bind r source-file ~/.tmux.conf \; display "config reloaded"
# split horizontal and vertical
bind | split-window -h
bind - split-window -v
# resize panes
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
# act like GNU screen
unbind C-b
set -g prefix C-a
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color
set -g status-bg default
set -g status-fg green
set -g pane-border-fg black
set -g pane-border-bg default
set -g pane-active-border-fg black
set -g pane-active-border-bg default
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# switch to last pane
bind-key C-a last-pane
# change default delay
set -sg escape-time 1
# mouse
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment