-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
66 lines (54 loc) · 3.05 KB
/
tmux.conf
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# set-window-option -g utf8 on
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@rmcup@'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
run '~/.tmux/plugins/tpm/tpm'
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
unbind ^B
bind ^B select-pane -t :.+
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 :+
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind-key -Tcopy-mode-vi C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind-key -Tcopy-mode-vi C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind-key -Tcopy-mode-vi C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind-key -Tcopy-mode-vi C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-\\) || tmux select-pane -l"
# C-l is taken over by vim style pane navigation
bind C-l send-keys 'C-l'
# pane resizing
# bind-key -n C-Space-Up resize-pane -U 15
# bind-key -n C-Space-Down resize-pane -D 15
# bind-key -n C-Space-Left resize-pane -L 25
# bind-key -n C-Space-Right resize-pane -R 25
bind-key -r h resize-pane -L 3
bind-key -r j resize-pane -D 3
bind-key -r k resize-pane -U 3
bind-key -r l resize-pane -R 3
# use vim keybinds in copy mode
setw -g mode-keys vi
# setup 'v' to begin selection as in vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi Escape send -X cancel
bind-key -Tcopy-mode-vi V send -X rectangle-toggle
bind-key -n C-u run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-u) || tmux copy-mode"
bind-key -n C-d run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-d) || tmux send-keys C-d"
# rebind C-u and C-d to C-b C-u and C-b C-d
bind C-u send-keys 'C-u'
bind C-d send-keys 'C-d'