-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
125 lines (103 loc) · 4.36 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Change prefix to C-a
set -g prefix C-a
unbind-key C-b
# Press C-a twice to switch to last window
bind-key C-a last-window
# Reload config on prefix+R
bind-key R source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded."
# Fix delay registering keys in programs running under tmux
set -sg escape-time 0
# Arrays start at 1
set -g base-index 1
setw -g pane-base-index 1
# Make sure programs know we're running tmux on a 256color terminal
set-option -g default-terminal "xterm-256color"
# Set proper terminal-overrides for st
if-shell '[ "$TERM" = "st-256color" ]' {
set-option -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
}
# Mousewheel scroll
set -g mouse on
# Vi mode
setw -g mode-keys vi
# Switch panes, aware of vim splits (vim-tmux-navigator)
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-Left if-shell "$is_vim" 'send-keys C-Left' 'select-pane -L'
bind-key -n C-Down if-shell "$is_vim" 'send-keys C-Down' 'select-pane -D'
bind-key -n C-Up if-shell "$is_vim" 'send-keys C-Up' 'select-pane -U'
bind-key -n C-Right if-shell "$is_vim" 'send-keys C-Right' 'select-pane -R'
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 -T copy-mode-vi -n C-Left select-pane -L
bind-key -T copy-mode-vi -n C-Down select-pane -D
bind-key -T copy-mode-vi -n C-Up select-pane -U
bind-key -T copy-mode-vi -n C-Right select-pane -R
bind-key -T copy-mode-vi -n C-h select-pane -L
bind-key -T copy-mode-vi -n C-j select-pane -D
bind-key -T copy-mode-vi -n C-k select-pane -U
bind-key -T copy-mode-vi -n C-l select-pane -R
# Switch windows
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
bind-key -n M-h previous-window
bind-key -n M-l next-window
# Swap panes
bind-key -n S-Up swap-pane -U
bind-key -n S-Down swap-pane -D
# Swap windows
bind-key -n S-Left swap-window -d -t -1
bind-key -n S-Right swap-window -d -t +1
# Resize panes
bind-key -n C-S-Left resize-pane -L
bind-key -n C-S-Right resize-pane -R
bind-key -n C-S-Up resize-pane -U
bind-key -n C-S-Down resize-pane -D
bind-key -n C-S-h resize-pane -L
bind-key -n C-S-l resize-pane -R
bind-key -n C-S-k resize-pane -U
bind-key -n C-S-j resize-pane -D
# Sane copy-pasting
bind-key p paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X begin-selection\; send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -in -selection primary'
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# Cycle between prompts
bind -T copy-mode-vi [ send-keys -X search-backward λ
bind -T copy-mode-vi ] send-keys -X search-forward λ
# Temporary cmus controller
bind-key n run-shell "tmux-run-fg cmus"
# Increase scrollback buffer size
set-option -g history-limit 100000
# Transparent mode
bind -T root C-p \
set-option prefix None \;\
set-option key-table off \;\
run-shell 'find ~/.config/tmux/plugins/nord-tmux/src/ -type f -exec sed -i "s/cyan/red/g" {} +' \;\
run-shell -b '~/.config/tmux/plugins/tpm/tpm' \;\
refresh-client -S
bind -T off -n C-p \
set-option -u prefix \;\
set-option -u key-table \;\
run-shell 'find ~/.config/tmux/plugins/nord-tmux/src/ -type f -exec sed -i "s/red/cyan/g" {} +' \;\
run-shell -b '~/.config/tmux/plugins/tpm/tpm' \;\
refresh-client -S
# Plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins/'
set-option -g @plugin 'tmux-plugins/tpm'
set-option -g @plugin 'arcticicestudio/nord-tmux'
# Choose between tmux-thumbs and tmux-fingers based on rustc availability
# We have to use @tpm_plugins because @plugin is parsed using awk and
# doesn't play well with the condition
if-shell 'command -v rustc' {
set-option -g @tpm_plugins 'fcsonline/tmux-thumbs'
set-option -g @thumbs-key F
set-option -g @thumbs-command 'echo -n {} | xclip -in -selection clipboard'
} {
set-option -g @tpm_plugins 'Morantron/tmux-fingers'
}
run-shell -b '~/.config/tmux/plugins/tpm/tpm'