Skip to content

Instantly share code, notes, and snippets.

@timtyrrell
Created December 2, 2014 17:39
Show Gist options
  • Save timtyrrell/1b2d4ca41765864d3b31 to your computer and use it in GitHub Desktop.
Save timtyrrell/1b2d4ca41765864d3b31 to your computer and use it in GitHub Desktop.
tmux.conf
setw -g mode-keys vi
set -g default-terminal "screen-256color"
set -g base-index 1
setw -g pane-base-index 1
unbind C-b
set -g prefix C-a
bind a send-keys C-a
bind C-a last-window
bind | split-window -h
bind - split-window -v
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind ` select-window -t 0
# clear pane
bind-key U send-keys -R
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l"
set-option -g terminal-overrides 'xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# Search for previous error
bind-key e copy-mode \; send-keys "?Error" C-m
set -sg escape-time 0
# scrollback buffer size increase
set -g history-limit 100000
# Use up and down arrows for temporary "maximize"
unbind Up; bind Up resize-pane -Z; unbind Down; bind Down resize-pane -Z
# Copy/paste interop
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind -t vi-copy y copy-pipe 'reattach-to-user-namespace pbcopy'
bind -t vi-copy v begin-selection
bind -t vi-copy V rectangle-toggle
# Allows scrolling and selecting in copy-mode
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
# Better project name in status bar
set -g status-left-length 18
set -g status-left '#[fg=colour235,bg=colour76,bold] #S '
# Easily resize tmux panes
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
# ——— Cosmetics ————————————————————————————————————————————————————
set -g status-utf8 on
set -g status-justify centre
set -g status-bg black
set -g status-left "#[fg=green]#S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%b %d #[fg=yellow]|#[fg=cyan]%l:%M %p"
setw -g window-status-bell-attr default
setw -g window-status-bell-fg red
setw -g window-status-activity-attr bold
setw -g window-status-format "#[fg=cyan]• #[fg=white]#I#[fg=cyan] #[fg=white]#12W"
setw -g window-status-current-format "#[fg=red]▶ #[fg=white]#I#[fg=red,bold] #[fg=white]#W"
set -g pane-border-fg colour238
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg black
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# ——— Cosmetics ————————————————————————————————————————————————————
if-shell '[[ -e ~/.tmux.conf.local ]]' 'source-file ~/.tmux.conf.local'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment