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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
### --- TPM --- ###
set-environment -gF TMUX_PLUGIN_MANAGER_PATH '#{HOME}/.local/bin/tmux/'
if 'test ! -d "${TMUX_PLUGIN_MANAGER_PATH}/tpm"' {
run 'mkdir -p "${TMUX_PLUGIN_MANAGER_PATH}" &&
git clone https://github.com/tmux-plugins/tpm "${TMUX_PLUGIN_MANAGER_PATH}/tpm" &&
${TMUX_PLUGIN_MANAGER_PATH}/tpm/bin/install_plugins'
}
### --- Settings --- ###
# general
set -as terminal-features 'xterm*:extkeys'
set -g base-index 1
set -g pane-base-index 1
set -g default-shell /usr/bin/zsh
set -g detach-on-destroy off
set -s extended-keys on
set -g focus-events on
set -g history-limit 1000000
set -g mouse on
set -g renumber-windows on
set -g set-clipboard on
set -g xterm-keys on
set -gq allow-passthrough on
set -sg escape-time 0
setw -g mode-keys vi
setw -g aggressive-resize on
# activity
set -g monitor-activity on
set -g visual-activity off
# color
set -g default-terminal "xterm-256color"
# set -g default-terminal 'screen-256color'
set -ga terminal-overrides ',xterm-256color:Tc'
set -sa terminal-features ',xterm-256color:RGB'
# status
set -g status-interval 1
set -g status-justify absolute-centre
set -g status-left ""
set -g status-left-length 10
set -g status-position top
set -g status-right ""
set -g status-style "bg=default"
### --- Key Bindings --- ###
# clear
bind 'l' "send-keys C-l; send-keys -R; clear-history"
# copy-mode
bind 'v' copy-mode
# lazygit
bind -n 'M-g' popup -d "#{pane_current_path}" -E -h 95% -w 95% -x 100% "EDITOR=nvim lazygit"
# pane
bind '%' split-window -h -c '#{pane_current_path}'
bind '"' split-window -v -c '#{pane_current_path}'
bind '|' split-window -h
bind '-' split-window -v
bind -r 'C-down' resize-pane -D 5
bind -r 'C-up' resize-pane -U 5
bind -r 'C-left' resize-pane -L 5
bind -r 'C-right' resize-pane -R 5
bind '@' choose-window 'join-pane -h -s "%%"'
bind '#' choose-window 'join-pane -s "%%"'
bind 'x' kill-pane
bind 'a' kill-pane -a
bind 'X' kill-window
bind 'A' kill-window -a
bind -n 'M-k' move-pane -h -t '.{up-of}'
bind -n 'M-l' move-pane -t '.{right-of}'
bind -n 'M-h' move-pane -t '.{left-of}'
bind -n 'M-j' move-pane -h -t '.{down-of}'
# prefix
unbind 'C-b'
set -g prefix 'C-Space'
bind 'C-Space' send-prefix
# reload
unbind 'r'
bind 'r' source-file "~/.config/tmux/tmux.conf"
# scripts
bind 'h' run-shell -b "~/.local/bin/tmuxtogglebar"
bind 'b' run-shell -b "~/.local/bin/tmuxcycleborder"
bind -T copy-mode M-\\ run-shell -b "~/.local/bin/tmuxtoggleterm"
bind -T copy-mode-vi M-\\ run-shell -b "~/.local/bin/tmuxtoggleterm"
bind -n 'C-t' run-shell "~/.local/bin/sessionizer"
bind -n 'M-t' run-shell "~/.local/bin/sessionizer"
bind -T copy-mode M-t run-shell "~/.local/bin/sessionizer"
bind -T copy-mode-vi M-t run-shell "~/.local/bin/sessionizer"
# sesh
bind -N "last-session (via sesh)" -n "M-'" run-shell 'sesh last'
bind -N "switch to root session (via sesh)" 9 run-shell 'sesh connect --root "$(pwd)"'
# session
bind -r '(' switch-client -p \; refresh-client -S
bind -nr 'M-P' switch-client -p \; refresh-client -S
bind -r ')' switch-client -n \; refresh-client -S
bind -nr 'M-N' switch-client -n \; refresh-client -S
bind "'" switch-client -t'{marked}'
bind -r 'BSpace' switch-client -l
# window
bind -r '<' swap-window -d -t -1
bind -r '>' swap-window -d -t +1
bind -nr 'M-H' previous-window \; refresh-client -S
bind -nr 'M-L' next-window \; refresh-client -S
bind 'c' new-window -c "#{pane_current_path}"
bind -nr 'M-BSpace' last-window
### --- Plugins --- ###
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'alexekdahl/tmux-compile'
set -g @plugin 'alexwforsythe/tmux-which-key'
set -g @plugin 'aserowy/tmux.nvim'
set -g @plugin 'catppuccin/tmux#v2.1.2'
set -g @plugin 'lost-melody/tmux-command-palette'
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'olimorris/tmux-pomodoro-plus'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'trevarj/tmux-open-nvim'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'xamut/tmux-weather'
### --- Plugins Settings --- ###
# command palette
set -g @cmdpalette-key-prefix 'prefix ?'
set -g @cmdpalette-key-root 'prefix C-b'
set -g @cmdpalette-key-copy-mode-vi 'copy-mode-vi C-_'
set -g @cmdpalette-cmdlists 'commands'
set -g @cmdpalette-cmd-commands 'prefix C-c'
# compile
set -g @compile-mode-key "C-a"
set -g @compile-mode-recompile-key "C-o"
set -g @compile-mode-kill-key "C-i"
set -g @compile-mode-height "35%"
set -g @compile-mode-history-file "$HOME/.local/share/history/compile-history"
set -g @compile-mode-session-history "off"
set -g @compile-mode-history-dir "$HOME/.local/share/history/compile-history-dir"
set -g @compile-mode-open-file-key "Enter"
# continuum
# set -g @continuum-boot 'on'
# set -g @continuum-boot-options 'kitty'
# set -g @continuum-restore 'on'
set -g @continuum-save-interval '1' # min, 0 for disable
# copycat
bind -T copy-mode-vi 'v' send-keys -X begin-selection
bind -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle
bind -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
# finger
set -g @fingers-key 'f'
set -g @fingers-enabled-builtin-patterns 'ip,uuid,url,path,hex,kubernate,git-status,git-status-branch,diff'
set -g @fingers-pattern-sha "[^-][0-9a-f]{7,128}"
set -g @fingers-pattern-0 "(([.\\w\\-~\\$@]+)(\\/?[\\w\\-@]+)+\\/?)\\.([\\w]+)(:\\d*:\\d*)?"
set -g @fingers-pattern-1 'git rebase --(abort|continue)'
set -g @fingers-pattern-2 "(\\+[0-9]{1,3}\\)?)?\\s?(\\s[0-9]{2,3}\\s[0-9]{3,4}\\s[0-9]{4}|\\-?[0-9]{2,3}\\-[0-9]{3,4}\\-[0-9]{4})"
set -g @fingers-ctrl-action "xargs -I {} tmux run-shell 'cd #{pane_current_path}; ton {}'"
# navigation
set -g @tmux-nvim-navigation true
set -g @tmux-nvim-navigation-cycle false
set -g @tmux-nvim-navigation-keybinding-left 'C-h'
set -g @tmux-nvim-navigation-keybinding-down 'C-j'
set -g @tmux-nvim-navigation-keybinding-up 'C-k'
set -g @tmux-nvim-navigation-keybinding-right 'C-l'
set -g @tmux-nvim-resize true
set -g @tmux-nvim-resize-step-x 2
set -g @tmux-nvim-resize-step-y 2
set -g @tmux-nvim-resize-keybinding-left 'C-left'
set -g @tmux-nvim-resize-keybinding-down 'C-down'
set -g @tmux-nvim-resize-keybinding-up 'C-up'
set -g @tmux-nvim-resize-keybinding-right 'C-right'
set -g @tmux-nvim-swap true
set -g @tmux-nvim-swap-cycle false
set -g @tmux-nvim-swap-keybinding-left 'C-M-h'
set -g @tmux-nvim-swap-keybinding-down 'C-M-j'
set -g @tmux-nvim-swap-keybinding-up 'C-M-k'
set -g @tmux-nvim-swap-keybinding-right 'C-M-l'
# open
set -g @open 'O'
set -g @open-editor 'C-e'
set -g @open-o 'https://www.searx.thesiah.xyz/?q='
# open-nvim
set -g @ton-prioritize-window false
# pomodoro
set -g @pomodoro_toggle 'p' # Start/pause a Pomodoro/break
set -g @pomodoro_cancel 'P' # Cancel the current session
set -g @pomodoro_skip '_' # Skip a Pomodoro/break
set -g @pomodoro_mins 25 # The duration of the Pomodoro
set -g @pomodoro_break_mins 5 # The duration of the break after the Pomodoro completes
set -g @pomodoro_intervals 4 # The number of intervals before a longer break is started
set -g @pomodoro_long_break_mins 25 # The duration of the long break
set -g @pomodoro_repeat 'off' # Automatically repeat the Pomodoros?
set -g @pomodoro_disable_breaks 'off' # Turn off breaks
set -g @pomodoro_on "#[fg=#{@thm_red}] " # The formatted output when the Pomodoro is running
set -g @pomodoro_complete "#[fg=#{@thm_red}] " # The formatted output when the break is running
set -g @pomodoro_pause "#[fg=#{@thm_yellow}] " # The formatted output when the Pomodoro/break is paused
set -g @pomodoro_prompt_break "#[fg=#{@thm_mauve}] " # The formatted output when waiting to start a break
set -g @pomodoro_prompt_pomodoro "#[fg=#{@thm_green}] " # The formatted output when waiting to start a Pomodoro
set -g @pomodoro_menu_position "R" # The location of the menu relative to the screen
set -g @pomodoro_sound 'off' # Sound for desktop notifications (Run `ls /System/Library/Sounds` for a list of sounds to use on Mac)
# (On Linux add `on` to use the `beep` program or add your custom beeping command)
set -g @pomodoro_notifications 'off' # Enable desktop notifications from your terminal
set -g @pomodoro_granularity 'on' # Enables MM:SS (ex: 00:10) format instead of the default (ex: 1m)
# resurrect
set -g @resurrect-save 'S'
set -g @resurrect-restore 'C-r'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'neomutt newsboat psql mysql sqlite3 ssh'
# side-bar
set -g @sidebar-tree 'e'
set -g @sidebar-tree-focus 'E'
set -g @sidebar-tree-command 'tree -C'
set -g @sidebar-tree-position 'right'
set -g @sidebar-tree-width '50'
# tpm
set -g @tpm-clean 'C-x'
# url
set -g @fzf-url-history-limit '2000'
# weather
set -g @tmux-weather-interval 60 # in minutes
set -g @tmux-weather-location "Seoul,KR"
set -g @tmux-weather-format "%c+%t+%w"
set -g @tmux-weather-units "m" # u for USCS, m for metric system
### --- Theme --- ###
# catppuccin
set -g @catppuccin_flavor "mocha"
set -g @catppuccin_pane_border_status "off"
set -g @catppuccin_pane_status_enabled "off"
set -g @catppuccin_window_number_position "left"
set -g @catppuccin_window_status_style "none" # basic or none
set -g @catppuccin_status_background "none"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_middle_separator ""
set -g @catppuccin_window_right_separator ""
set -g @catppuccin_window_current_middle_separator ""
set -ogq @catppuccin_status_left_separator ""
set -ogq @catppuccin_status_middle_separator ""
set -ogq @catppuccin_status_right_separator ""
set -ogq @catppuccin_status_connect_separator "yes" # yes, no
set -ogq @catppuccin_status_module_bg_color "none"
# online
set -g @online_icon "ok"
set -g @offline_icon "nok"
# status left style
set -ogq @thm_bg "default" # transparent background
set -g status-left ""
set -g status-left-length 90
set -ga status-left "#[bg=default,fg=#{@thm_red}] #(tmux list-sessions | nl | grep -w \"$(tmux display-message -p '#S')\" | awk '{print \$1}' | tr -d '[:space:]')/#(tmux list-sessions | wc -l | tr -d '[:space:]') "
set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_surface_2},fg=#{@thm_green},bold,italics] #S },#{#[bg=default,fg=#{@thm_green}] #S }}"
set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=default,fg=#{@thm_subtext_0}] #{pane_current_command} "
set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=default,fg=#{@thm_blue}] #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-left "#{?#(gitmux -cfg $HOME/.config/gitmux/gitmux.conf '#{pane_current_path}'),#{#[bg=default,fg=#{@thm_subtext_0}] #(gitmux -cfg $HOME/.config/gitmux/gitmux.conf '#{pane_current_path}') }, }"
set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
set -ga status-left "#[bg=default,fg=#{@thm_subtext_0}]#{?window_zoomed_flag, zoom ,}"
# status right style
set -ogq @batt_icon_charge_tier8 ""
set -ogq @batt_icon_charge_tier7 ""
set -ogq @batt_icon_charge_tier6 ""
set -ogq @batt_icon_charge_tier5 ""
set -ogq @batt_icon_charge_tier4 ""
set -ogq @batt_icon_charge_tier3 ""
set -ogq @batt_icon_charge_tier2 ""
set -ogq @batt_icon_charge_tier1 ""
set -ogq @batt_icon_status_charged ""
set -ogq @batt_icon_status_charging ""
set -ogq @batt_icon_status_discharging ""
set -ogq @batt_icon_status_unknown ""
set -ogq @batt_icon_status_attached ""
set -g status-right ""
set -g status-right-length 90
set -ga status-right "#{?#{pomodoro_status},#{pomodoro_status},#{#[bg=default,fg=#{@thm_peach}] }}"
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-right "#[bg=default,fg=#{@thm_mauve}] #{continuum_status} "
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
# TODO: configure when the battery is available
set -ga status-right "#{?#{<=:#{battery_percentage},0},#{#[bg=default,fg=#{@thm_red}] #{battery_icon} },#{#[bg=default,fg=#{@thm_green}]} #{battery_icon} #{battery_percentage} }"
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-right "#[bg=default]#{?#{==:#{online_status},ok},#[fg=#{@thm_pink}] ,#[fg=#{@thm_red},bold]#[reverse] }"
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
# set -ga status-right "#[bg=default,fg=#{@thm_red}] #{weather} "
# set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-right "#[bg=default,fg=#{@thm_rosewater}] #(uptime | awk -F 'up ' '{print $2}' | awk -F ',' '{print $1}' | sed 's/:/h /;s/^ //') "
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
set -ga status-right "#[bg=default,fg=#{@thm_blue}] %a,%d %H:%M "
set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none] "
# pane border style
setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
setw -g pane-border-format ""
setw -g pane-border-lines single
setw -g pane-border-status top # top or off
setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
# window style
set -wg automatic-rename on
set -g automatic-rename-format "Window" # Window or ""
set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-style "bg=default,fg=#{@thm_rosewater}"
set -g window-status-last-style "bg=#{@thm_surface_2},fg=#{@thm_peach}"
set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_surface_0}"
set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_surface_0},bold"
set -g window-status-separator '|'
set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_surface_0},bold"
### --- RUN TPM --- ###
run '${TMUX_PLUGIN_MANAGER_PATH}/tpm/tpm'
|