summaryrefslogtreecommitdiff
path: root/tmux/.tmux.conf
blob: 9baf9f3ee09522e1dc4223dab6822fa39a58dc23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set -g default-terminal "screen-256color"
set -g status on
set -g mouse on

unbind C-b
set -g prefix C-s
bind s send-prefix

unbind r
bind r source-file ~/.tmux.conf

set -sg escape-time 0
set-option -g allow-rename off

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n C-h if-shell "$is_vim" "send-keys C-h" 'if-shell "[ #{pane_at_left} -eq 1 ]" "select-window -p" "select-pane -L"'
bind -n C-l if-shell "$is_vim" "send-keys C-l" 'if-shell "[ #{pane_at_right} -eq 1 ]" "select-window -n" "select-pane -R"'
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-Left  previous-window
bind -n C-Right next-window

bind-key P swap-window -t -1
bind-key N swap-window -t +1