You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.8 KiB

set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*-256color:Tc" # enable 24-bit color
## messages
set-option -g display-time 3000
## scrollback buffer
set-option -g history-limit 10000
## window notifications
set-option -g visual-activity on
set-window-option -g monitor-activity off
## title
set-option -g set-titles on
set-option -g set-titles-string "[#S] #I:#W"
set-option -g automatic-rename on
## mouse
# set -g mouse on
# copy and paste
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel pbcopy
bind-key -T copy-mode-vi 'H' send -X start-of-line
bind-key -T copy-mode-vi 'L' send -X end-of-line
# colors
set -g pane-active-border-style fg=brightred
set -g pane-border-status top
set -g pane-border-format ' #{pane_current_command} '
# statusline (shamelessly stolen from powerline)
BG_COLOR='#262626'
set-option -g status-interval 2
set-option -g status-left "#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold]#[noitalics]#[nounderscore],#[fg=colour16]#[bg=colour254]#[bold]#[noitalics]#[nounderscore]} #S #{?client_prefix,#[fg=colour31],#[fg=colour254]}#[bg=$BG_COLOR]#[nobold] "
set-option -g status-left-length 20
set-option -g status-right ""
set-option -g status-style fg=colour231,bg=$BG_COLOR
set-option -g window-status-activity-style fg=colour11,bg=$BG_COLOR
set-option -g window-status-bell-style fg=colour1,bg=$BG_COLOR
set-option -g window-status-current-format "#[fg=colour0,bg=colour31,nobold,noitalics,nounderscore] #[fg=colour117,bg=colour31,nobold,noitalics,nounderscore]#I#F#[fg=colour231,bg=colour31,bold,noitalics,nounderscore] #W #[fg=colour31,bg=$BG_COLOR,nobold,noitalics,nounderscore]"
set-option -g window-status-format "#[fg=colour244,bg=$BG_COLOR,nobold,noitalics,nounderscore] #I#{?window_flags,#F, } #[fg=colour240,bg=colour0,nobold,noitalics,nounderscore]#[default]#W "
set-option -g window-status-last-style fg=colour31,bg=$BG_COLOR
set-option -g window-status-style fg=colour249,bg=$BG_COLOR
## etc
set-window-option -g mode-keys vi
set-option -sg escape-time 1 # increase vim responsiveness
set-option -g base-index 1
## screen bindings
bind a send-prefix
bind c new-window
bind C-c new-window
bind d detach
bind C-d detach
bind n next-window
bind C-n next-window
bind p previous-window
bind C-p previous-window
bind C-a last-window
set-option -g renumber-windows on;
bind c new-window -c '#{pane_current_path}';
bind C-c new-window -c '#{pane_current_path}';
bind v split-window -h -c '#{pane_current_path}';
bind s split-window -v -c '#{pane_current_path}';
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n 'C-j' if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n 'C-k' if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n 'C-l' if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n 'C-\' if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# fzf-git
bind-key -T root C-g switch-client -T fzf-git
bind-key -T fzf-git C-f send-keys C-g f
bind-key -T fzf-git C-g send-keys C-g g # branches is bound to `g` since `b` doesn't work
# maybe since it conflicts w/the normal C-b prefix?
bind-key -T fzf-git C-t send-keys C-g t
bind-key -T fzf-git C-r send-keys C-g r
bind-key -T fzf-git C-h send-keys C-g h
bind-key -T fzf-git C-s send-keys C-g s
bind -r < resize-pane -L 3
bind -r > resize-pane -R 3
bind -r - resize-pane -D 3
bind -r + resize-pane -U 3
bind -r = resize-pane -U 3
unbind r
bind r source-file ~/.tmux.conf \; display 'Reloaded tmux.conf'
if-shell "[[ -e ~/.tmux.conf.local ]]" "source-file ~/.tmux.conf.local"