-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_tmux.conf
More file actions
287 lines (229 loc) · 7.69 KB
/
dot_tmux.conf
File metadata and controls
287 lines (229 loc) · 7.69 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# ~/.tmux.conf
###########################################################################
### GLOBAL OPTIONS
###########################################################################
run-shell "tmux set-option -g @tinted-color $(tinty current)"
run-shell 'tmux set -g @dim-bg "$(~/.config/tmux/dim-bg.sh #{@tinted-color})"'
set -g focus-events on
set -g default-terminal "tmux-256color"
set -sg terminal-overrides ",*:RGB"
set-option -g default-shell /bin/zsh
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-option -g bell-action none
set-window-option -g monitor-activity off
# This is used for images
set -gq allow-passthrough on
set -g set-clipboard on
# Change prefix from default (C-b) to C-a
# C-a doesn't interfere with emacs-style editing keys
unbind -n C-b
unbind -n C-a
set -g prefix C-a
set -g mouse on
setw -g mode-keys vi
# Watch for activity in background windows
setw -g monitor-activity on
# scrollback size
set -g history-limit 10000
# set first window to index 1 (not 0) to map more to the keyboard layout
set -g base-index 1
setw -g pane-base-index 1
# Escape Key Timeout (Avoid annoying lags in vim for example)
set -s escape-time 0
# pass through xterm keys
set -g xterm-keys on
# Renumber windows automatically
set-option -g renumber-windows on
# Stop renaming windows
set-window-option -g automatic-rename off
set-option -g allow-rename off
# vim in copy mode
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
###########################################################################
### GLOBAL KEY BINDINGS
###########################################################################
# Keep your finger on ctrl, or don't, same result
bind-key C-d detach-client
bind-key C-p paste-buffer
# Redraw the client (if interrupted by wall, etc)
bind R refresh-client
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
# Escape goes into copy mode (Habits...)
unbind [
bind Escape copy-mode
# create a new Window
unbind C-w
bind C-w new-window -c "#{pane_current_path}" -n ""
# create a new session
unbind C-s
bind-key C-s new-session
# create a new named window
unbind c
bind-key c command-prompt -p "window name:" "new-window -c '#{pane_current_path}'; rename-window '%%'"
# create a new named session
unbind C
bind-key C command-prompt -p "session name:" "new-session; rename-session '%%'"
# order tmux sessions alphabetically
unbind w
bind w choose-tree -Zs -O name
# No confirm on pane kill
unbind x
bind-key x kill-pane
# No confirm on window kill
unbind X
bind-key X kill-window
# kill session
unbind C-x
bind-key C-x kill-session
# Restore a way to clear terminal using C-l
# As C-l is remapped for navigation
bind C-l send-keys 'C-l'
# Join back pane
unbind j
bind j join-pane -s !
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
###########################################################################
### PANE & WINDOW MANAGEMENT
###########################################################################
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 10
bind-key L resize-pane -R 10
bind e setw synchronize-panes on
bind E setw synchronize-panes off
bind '"' split-window -v -c "#{pane_current_path}" -l 50%
bind ^ split-window -h -c "#{pane_current_path}" -l 40%
bind % split-window -h -c "#{pane_current_path}" -l 50%
# bind o split-window -c "#{pane_current_path}" \; resize-pane -D 15
# bind O split-window -h -c "#{pane_current_path}" \; resize-pane -R 30
###########################################################################
### POPUPS
###########################################################################
# Open shell popup in current directory
unbind t
bind-key t display-popup -d "#{pane_current_path}" -w 80% -h 80%
# Open lazygit popup
unbind g
bind-key g display-popup -d "#{pane_current_path}" -w 90% -h 90% -E lazygit
# Open opencode popup
bind-key o display-popup -d "#{pane_current_path}" -w 90% -h 90% -E opencode $HOME
###########################################################################
### DESIGN CHANGES ###
###########################################################################
### messages
set -g message-style "fg=colour255 bg=colour4 bright"
### statusbar
set-option -g status on
# set -g status 2
set -g status-position top
set -g status-justify centre
set -Fg 'status-format[1]' '#{status-format[0]}'
set -g 'status-format[1]' ''
set -g status-style "bg=colour0 fg=colour255 bright"
set -g status-left '#S'
set -g status-right ''
# set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 100
set-option -g status-right-length 100
### Windows
setw -g window-status-current-style "fg=colour255 bg=colour0 bright"
setw -g window-status-current-format ' #I #F '
setw -g window-status-style "fg=colour250 bg=colour0 none"
setw -g window-status-format ' #I #F '
setw -g window-status-bell-style "fg=colour255 bg=colour0 bright"
### modes
setw -g clock-mode-colour colour5
setw -g mode-style "fg=colour1 bg=colour0 bright"
### panes
set -g pane-border-style "fg=colour241, bg=#181B26"
set -g pane-active-border-style "fg=colour255, bg=#181B26"
###########################################################################
### NAVIGATION
###########################################################################
is_vim="tmux list-panes -F '#{pane_current_command}' | grep nvim"
# bind o if-shell "$is_vim" {
# select-pane -R
# } {
# select-pane -L
# if-shell "$is_vim" { resize-pane -Z }
# }
bind-key -n C-h if-shell "$is_vim" {
send-keys C-h
} {
select-pane -L
# if-shell "$is_vim" { resize-pane -Z }
}
bind-key -n C-j if-shell "$is_vim" {
send-keys C-j
} {
select-pane -D
# if-shell "$is_vim" { resize-pane -Z }
}
bind-key -n C-k if-shell "$is_vim" {
send-keys C-k
} {
select-pane -U
# if-shell "$is_vim" { resize-pane -Z }
}
bind-key -n C-l if-shell "$is_vim" {
send-keys C-l
} {
select-pane -R
# if-shell "$is_vim" { resize-pane -Z }
}
bind-key -n C-_ if-shell "$is_vim" {
send-keys C-_
if-shell '[ "$(tmux list-panes | wc -l)" -eq 1 ]' \
'split-window -h -c "#{pane_current_path}" -l 40%' \
'select-pane -R'
} {
select-pane -R
if-shell "$is_vim" { resize-pane -Z }
}
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
# bind-key -T copy-mode-vi C-\ select-pane -l
###############
### OS Specific
###############
# %if "#{==:#{WSL},1}"
source-file ~/.tmux.wsl.conf
# %endif
# %if "#{==:#{MACOS},1}"
source-file ~/.tmux.macos.conf
# %endif
###########################################################################
###########################################################################
# List of plugins
# set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tinted-theming/tinted-tmux'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tpm'
run '~/.tmux/plugins/tpm/tpm'
###########################################################################
###########################################################################
set -g window-active-style 'bg=default'
set -g window-style 'bg=default'
# set-hook -g pane-focus-out 'select-pane -P bg=default,fg=default'
# set-hook -g pane-focus-in 'select-pane -P bg=default,fg=default'
# set-hook -g pane-focus-out "refresh-client -S"
# set-hook -g pane-focus-in "refresh-client -S"
set-hook -g pane-focus-in "select-pane -P 'bg=default'"
set-hook -g pane-focus-out "select-pane -P 'bg=#{@dim-bg}'"