-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.tmux.conf
More file actions
344 lines (232 loc) · 11.2 KB
/
.tmux.conf
File metadata and controls
344 lines (232 loc) · 11.2 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
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
set -g focus-events on
# This makes sure that tmux in nvim when I ssh into a computer it makes
# sure that when I copy thing, It coppies to my clipboard. It makes sure that
# also vim.g.clipboard = "osc52" in my nvim configs work well.
set -s set-clipboard on
# Toggle local tmux "Off" to control the remote tmux
bind -T root F11 \
set prefix None \;\
set key-table off \;\
set status-style "fg=colour245,bg=colour235" \;\
if-shell -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
# Toggle local tmux "On" to regain control
bind -T off F11 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
refresh-client -S
# beautiful fix to Shift+pageup and shift+pagedown in tmux.
bind -n S-PageUp copy-mode -u
bind -n S-PageDown send-keys PageDown
#---- This is important for nvim working well and for ghostty working well with ssh
set-option -g default-terminal "tmux-256color"
# set-option -ga terminal-features ",*256color*:RGB"
# set-option -s escape-time 0
set -sg escape-time 0
set -g status-style 'bg=#333333 fg=#5eacd3'
# Set the right side of the status bar to be empty
# set-option -g status-right ""
set-option -g status-right "%Y-%m-%d %H:%M"
# Give the window list more space
set-option -g status-left-length 30 # Reserve 30 chars for the left side (session name, etc.)
set-option -g status-right-length 0 # Reserve 0 chars for the right side, since it's empty
bind S run-shell tmux-ready
# isn't this redundant?
# Enable True Color (RGB) support for capable terminals
# set-option -ga terminal-features ",*256color*:RGB"
# set-option -ga terminal-features ",alacritty:RGB"
# this is htop because btop needs good resize and yeah
# bind-key M-h run-shell "tmux neww tmux-sessionizer -s 0"
# [solid]this is lazygit. But, i don't use it as much. Gotta get good at lazygit and git.
# bind-key -n M-l run-shell "tmux neww tmux-sessionizer -s 1"
# [Question] This is nvim opened in ~/ idk why man... what's even the point of this ?
# bind-key -n M-n run-shell "tmux neww tmux-sessionizer -s 2"
# [potential removal] this is matrix I don't care about this bs
# bind-key -n M-b run-shell "tmux neww tmux-sessionizer -s 3"
# [Questoin] This is btop What's even the point of this ? when you have it in _a_ like what ?
# bind-key -n M-y run-shell "tmux neww tmux-sessionizer -s 4"
#========== window management (tabs)
bind-key -n M-1 select-window -t :1
bind-key -n M-2 select-window -t :2
bind-key -n M-3 select-window -t :3
bind-key -n M-4 select-window -t :4
bind-key -n M-5 select-window -t :5
bind-key -n M-6 select-window -t :6
bind-key -n M-7 select-window -t :7
bind-key -n M-8 select-window -t :8
bind-key -n M-9 select-window -t :9
bind-key -n M-0 select-window -t :10
#========== pane management
bind-key w display-panes
TMUXCLIP_PATH="~/.local/bin/Tmuxclip"
## why even remap from C-b to C-s in the first place when or to C-a when I don't even use them lol.
## The default one is fine
# Remap prefix from 'C-b' to 'C-s'
# unbind C-b
# Set the first prefix to Ctrl-s
# set-option -g prefix C-s
# Set the second prefix to Ctrl-b
# set-option -g prefix2 C-b
# bind-key C-b send-prefix -2
# Set a higher history limit
set-option -g history-limit 10000
# Allow repeating commands without re-typing the prefix (e.g., C-a > >)
set-option -g repeat-time 500
# Start window and pane numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows automatically to prevent gaps
set -g renumber-windows on
# Enable full mouse support
set -g mouse on
# Allow Tmux to use the OSC 52 escape sequences for copy/paste
set -g allow-passthrough on
# If you are still having issues, explicitly bind the copy/paste operations to OSC 52
# (These lines are sometimes only necessary if you use Tmux's copy mode, but they help.)
set -w -g automatic-rename on
# Greatly improve responsiveness for editors like Vim
# --- [2] NAVIGATION (THE VIM WAY) ---
bind -r a last-window
bind-key -n 'M-`' last-window
bind -r h previous-window
bind -r l next-window
# is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# Use bind-key -r, which requires the prefix but is safe for all terminals.
# bind-key -r 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
# bind-key -r 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
# bind-key -r 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
# bind-key -r 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' # <-- Typo fixed here
#---- Copy mode:
# Use vi-style keys in copy mode
set-window-option -g mode-keys vi
# Simulating viw and viW in nvim.
bind-key -T copy-mode-vi i send-keys -X select-word
bind-key -T copy-mode-vi I send-keys -X cursor-right \; send-keys -X previous-space \; send-keys -X begin-selection \; send-keys -X next-space-end
# alternative to "I"
# bind-key -T copy-mode-vi I send-keys -X previous-space \; send-keys -X begin-selection \; send-keys -X next-space-end
# These bindings for copy mode are fine as they are.
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 Alt+j to scroll half page down in copy mode
bind-key -T copy-mode-vi M-j send-keys -X halfpage-down
# Bind Alt+k to scroll half page up in copy mode
bind-key -T copy-mode-vi M-k send-keys -X halfpage-up
# --- [1] KEY BINDINGS ---
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
bind ` switch-client -t'{marked}'
## do not do C-a that will screw up tmux's C-a sadly with this you have to hit C-a twice
# bind-key -r M-a switch-client -l
bind-key -n M-a switch-client -l
bind M-j choose-window 'join-pane -h -s "%%"'
bind J choose-window 'join-pane -s "%%"'
# --- [3] PANE MANAGEMENT ---
#========== Pane Border Styling ("The Green Box")
set -g status-position bottom
# Use 'heavy' lines for a more condensed, solid look (or try 'single' or 'double')
# set -g pane-border-lines single
# 1. Enable a border at the top of every pane
# set -g pane-border-status bottom
# 2. Keep the border clean (remove the default "1:zsh" text from the border line)
# set -g pane-border-format ""
# 3. Set the active border to your favorite green
# set -g pane-active-border-style "fg=green,bg=default"
# 4. Set the inactive borders to a dim color (matching your status bar bg)
# This makes the active green "box" pop out against the rest.
# set -g pane-border-style "fg=#333333,bg=default"
bind | split-window -hc "#{pane_current_path}"
bind - split-window -vc "#{pane_current_path}"
bind \\ split-window -hc "#{pane_current_path}"
bind _ split-window -vc "#{pane_current_path}"
bind -r x kill-pane
bind -r b break-pane
# Fuzzy find sessions to switch to
bind C-c send-keys 'C-l'
# ---- Popups ------------
# bind g display-popup -w 80% -h 80% "lazygit"
# bind g display-popup -E -w 90% -h 90% lazygit
bind-key -r g display-popup -d '#{pane_current_path}' -w 90% -h 90% -E "lazygit"
# bind e display-popup -w 80% -h 80% "yazi"
# Shows only the tmux sessions I have
bind C-t display-popup -h 80% -E "tmux list-sessions | sed 's/:.*//' | fzf --reverse | xargs tmux switch-client -t"
bind '!' display-popup -w 80% -h 80% "htop"
# bind C-b display-popup -w 95% -h 95% "btop"
# Fuzzy find windows in the current session
bind s display-popup -E "tmux list-windows -F '#I:#W' | fzf --reverse | sed 's/:.*//' | xargs tmux select-window -t"
# A quick calculator using 'qalc' (requires qalculate)
bind C display-popup -w 50% -h 50% -E "qalc"
# Toggle the scratchpad popup window
bind "'" run-shell "~/.local/scripts/tmux-scratchpad.sh"
# A universal key to close any focused popup window
bind-key q detach-client -P
# "Promote" the scratchpad to a NEW WINDOW in the current session.
# This binding should be used AFTER closing the popup.
bind M-Enter new-window -d -t _scratchpad: \; move-window -s _scratchpad:
# "Join" the scratchpad as a NEW PANE in the current window (Vertical Split)
# This binding should be used AFTER closing the popup.
bind M-| new-window -d -t _scratchpad: \; join-pane -h -s _scratchpad:
# "Join" the scratchpad as a NEW PANE in the current window (Horizontal Split)
# This binding should be used AFTER closing the popup.
bind M-_ new-window -d -t _scratchpad: \; join-pane -v -s _scratchpad:
# --- NAVIGATION ---
bind-key W choose-window
# Shows the tmux sessions and you know. possible tmux seesions to open from ~/
# this is what I'm used to see
# this is meh I don't like it.
bind-key -r t run-shell "tmux neww ~/.local/scripts/tmux-sessionizer"
bind-key -n M-t run-shell "tmux neww ~/.local/scripts/tmux-sessionizer"
bind-key -r T run-shell "tmux neww ~/.local/bin/scratchpad-sessionizer"
bind-key -n M-s run-shell "tmux neww ~/.local/bin/scratchpad-sessionizer"
# the pop up is ass I like
bind f display-popup -h 80% -E "~/.local/scripts/tmux-sessionizer"
# Find a file and open it in a new horizontal split
# This should be like a dotfiles you know folder and then I like do ln -s and put stuff in it. and then it searches those locations or files instead of like this huge bs that I never use anyways
# bind o display-popup -w 80% -h 80% -E "fd . -t f -H --ignore-file ~/scripts/excludes/fd/excludes_for_a_tmux_pop_up | fzf --reverse | xargs -I {} tmux split-window -h 'nvim {}'"
# Toggle pane synchronization it's so sick if you have multiple panes and you want to type in all of them at once
bind M-v set-window-option synchronize-panes
# Open the session chooser menu
bind M-f choose-session
# it will kill the whole window with all it's panes unlike bind x where it only kills pane
bind X kill-window
bind -r C-M-h resize-pane -L 5
bind -r C-M-j resize-pane -D 5
bind -r C-M-k resize-pane -U 5
bind -r C-M-l resize-pane -R 5
bind z resize-pane -Z
#======
bind -r "<" swap-window -d -t -1
bind -r ">" swap-window -d -t +1
# Make pane swapping repeatable ('spamable')
bind-key -r '{' swap-pane -U
bind-key -r '}' swap-pane -D
# --- [4] WINDOW MANAGEMENT ---
bind c new-window -c "#{pane_current_path}"
bind , command-prompt "rename-window '%%'"
# --- [5] COPY MODE (THE VIM WAY) ---
# default copy mode
# bind [ copy-mode
# copy mode with the script to make it have relative numbers
bind [ run-shell "~/.local/scripts/tmux-copy-mode-lines.sh"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi q send-keys -X rectangle-toggle
# For X11 (most common with QTerminal/LXQt)
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in"
# OR if you are on Wayland:
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
# bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "wl-copy"
# screw the script.
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "~/.local/scripts/Tmuxclip"
# bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "~/.local/scripts/Tmuxclip"
bind P paste-buffer
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-restore 'on'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_with_mouse 'on'
set -g @override_copy_command 'xclip -selection clipboard'
run '~/.tmux/plugins/tpm/tpm'