Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
205 lines (149 sloc) 5.85 KB
############################
##### GENERAL SETTINGS #####
############################
# set terminal type
set -g default-terminal "screen-256color"
# long scrollback buffer
set -g history-limit 100000
# listen for activity on all windows
set -g bell-action any
# xterm-style function key sequences
setw -g xterm-keys on
# control automatic window renaming
setw -g automatic-rename on
# pane indexes start from 1, not 0
set -g base-index 1
# auto renumber window on close
setw -g renumber-windows on
setw -g aggressive-resize on
# focus events enabled for terminals that support them
set -g focus-events on
# workaround for DBUS notification not showing
set -g update-environment "DBUS_SESSION_BUS_ADDRESS DISPLAY SSH_AUTH_SOCK XAUTHORITY"
###########################
##### KEYBOARD CONFIG #####
###########################
# C-a instead of C-b
unbind-key C-b
set -g prefix C-a
# press ; to issue command
bind-key \; command-prompt
# fast Esc
set -s escape-time 10
# send the prefix to client inside window
bind-key C-a send-prefix
# disable repeat time
set -g repeat-time 0
# use vi keys in copy-mode
set -g mode-keys vi
# new pane/window with current directory
bind-key c new-window -c '#{pane_current_path}'
bind-key C new-window -a -c '#{pane_current_path}'
bind-key r rotate-window
# switch panes with alt + arrows
bind-key -n M-Up if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -U" "send-keys 'M-Up'"
bind-key -n M-Down if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -D" "send-keys 'M-Down'"
bind-key -n M-Left if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -L" "send-keys 'M-Left'"
bind-key -n M-Right if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -R" "send-keys 'M-Right'"
# select last pane with alt + f
bind-key -n M-f last-pane
# split window with alt + shift + arrows
bind-key -n M-S-Up split-window -vb -c '#{pane_current_path}'
bind-key -n M-S-Down split-window -v -c '#{pane_current_path}'
bind-key -n M-S-Left split-window -hb -c '#{pane_current_path}'
bind-key -n M-S-Right split-window -h -c '#{pane_current_path}'
# switch windows with alt + j/k or q/w
bind-key -n M-q previous-window
bind-key -n M-w next-window
# mark pane with alt + m
bind-key -n M-m select-pane -m
# move marked pane to current window with alt + p/P
bind-key -n M-p join-pane -h
bind-key -n M-P join-pane -v
# select window with alt + number
bind-key -n M-1 select-window -t :=1
bind-key -n M-2 select-window -t :=2
bind-key -n M-3 select-window -t :=3
bind-key -n M-4 select-window -t :=4
bind-key -n M-5 select-window -t :=5
bind-key -n M-6 select-window -t :=6
bind-key -n M-7 select-window -t :=7
bind-key -n M-8 select-window -t :=8
bind-key -n M-9 select-window -t :=9
# zoom pane with alt + 0
bind-key -n M-0 resize-pane -Z
# switch pane border status with prefix + t/T
bind-key t set pane-border-status off
bind-key T set pane-border-status top
bind-key p run-shell "pstree -alU #{pane_pid}"
bind-key P run-shell "pstree -alpU #{pane_pid}"
# integrate with system clipboard
bind-key -t vi-copy y copy-pipe "xsel -ipb"
bind-key -n C-v run "xsel -bo | tmux load-buffer - ; tmux paste-buffer"
bind-key C-v send C-v
########################
##### MOUSE CONFIG #####
########################
set -gq mouse on
bind-key -n WheelUpPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Up Up Up' \
'copy-mode -e'\""
bind-key -n WheelDownPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Down Down Down'\""
# paste with middle click
bind-key -n MouseDown2Pane run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# drag & drop windows on status line by mouse
bind-key -n MouseDrag1Status swap-window -t=
# new window by right click on status line
bind-key -n MouseDown3Status new-window -a -t= -c '#{pane_current_path}'
# new window in background by middle click on status line
bind-key -n MouseDown2Status new-window -ad -t= -c '#{pane_current_path}'
# don't scroll to bottom after mouse select
bind-key -t vi-copy MouseDragEnd1Pane copy-selection -x
# exit from copy-mode with right-click
unbind-key -n MouseDown3Pane
bind-key -t vi-copy MouseDown3Pane cancel
# old mouse handling (tmux 2.0 and before)
set -gq mode-mouse on
set -gq mouse-resize-pane on
set -gq mouse-select-pane on
set -gq mouse-select-window on
###############################
##### STATUS LINE OPTIONS #####
###############################
set -g set-titles on
set -g set-titles-string "[tmux] #T"
setw -g window-status-format '#F#I:#{=24:window_name}'
setw -g window-status-current-format '#{?client_prefix,#[bg=red],#{?pane_in_mode,#[bg=yellow]#[fg=black],#[bg=blue]}} #F#I:#{=24:window_name} '
set -g window-status-separator ' '
set -g status-left '[#S] '
set -g status-left-length 20
set -g status-right ' #{pane_pid}: #T '
set -g pane-border-status top
set -g pane-border-format '#[fg=black]#{?pane_in_mode,#[bg=yellow],#[bg=white]#[bold]} #T '
# status bar messages display time
set -g display-time 3000
# refresh status line frequency (in sec)
set -g status-interval 2
##################
##### STYLES #####
##################
set -g pane-border-style fg=blue,bg=white
set -g pane-active-border-style fg=white,bg=blue
set -g status-style fg=black,bg=white
set -g status-right-style fg=white,bg=blue,bold
setw -g window-status-style default,bold
setw -g window-status-current-style fg=white,bg=blue,bold
set -g message-style fg=white,bg=blue,bright