-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
605 lines (470 loc) · 27.4 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
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# ================================================
# === REFERENCES ===
# ================================================
#
# https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
# NOTE: Got this directly from Mathias Bynens repo - https://github.com/mathiasbynens/dotfiles/blob/main/.tmux.conf
# NOTE: This is more for iterm but effects tmux
# https://superuser.com/questions/565178/how-do-i-get-the-numpad-to-work-in-vim-using-iterm2-on-osx-with-term-xterm/939832#939832
# https://linuxhint.com/how-to-reload-tmux-config-file/
# https://mutelight.org/practical-tmux
#
# -----------------------------------------------------------------------------
#
# URLs to read:
#
# http://blog.yjl.im/2009/11/migrating-to-tmux-from-gnuscreen.html
# http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/
# http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
# http://www.dayid.org/os/notes/tm.html
#
# Other sample tmux.conf files
#
# http://www.mindfuzz.net/?p=178
#
# -----------------------------------------------------------------------------
# Prefix-c = This will show the current options for tmux and the list...THIS IS AWESOME, and informative
# ================================================
# === GENERAL SETTINGS ===
# ================================================
# Start windows and panes at 1 not 0 for tmux
set-option -g base-index 1
set-option -g pane-base-index 1
# renumber the windows on the status after closing a window
set-option -g renumber-windows on
# Use Ctrl+A as the prefix key
set-option -g prefix C-a
unbind C-b
bind C-a send-prefix
# SHELL Default to be zsh (or whatever the current shell is now) and not necessarily bash
# set-option -g default-shell "/bin/zsh"
set-option -g default-shell $SHELL
# set-option -g default-command $SHELL
# NOTE: This changes and affects the DELETE key for some reason
# set-option -g default-terminal "xterm-256color" # been working with this as default for months
# set-option -g default-terminal "screen-256color"
set-option -g default-terminal "tmux-256color" # change to this per nvim health check ???
# set-option -ag terminal-overrides ",*256color*:Tc"
set-option -ag terminal-overrides ",xterm-256-color:Tc" # NOTE: not exactly sure what this terminal-overrides does
set-option -ag terminal-features 'tmux-256color:RGB,xterm-256-color:RGB' # NOTE: recommended by nvim checkhealth
# Listen for activity / bell on all windows
set-option -g bell-action any
# set-option -g bell-action none
set-option -wg monitor-activity on
set-option -g visual-activity on
set-option -g visual-bell off
set-option -g visual-silence both
# set-option -g silence-action current
# control automatic window renaming
# set-option -wg automatic-rename off
# Enable wm window titles
set-option -g set-titles on
# set-option -g set-titles-string "#T"
# Repeat delay time for the same button (default 500)
set-option -g repeat-time 650
# ================================================
# === MacOS ===
# ================================================
# NOTE: taken from https://github.com/craftzdog/dotfiles-public/blob/master/.config/tmux/
# osx clipboard
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# Undercurl
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# ================================================
# === Utility ===
# ================================================
# Display lazygit
# NOTE: taken from https://github.com/craftzdog/dotfiles-public/blob/master/.config/tmux/
# bind-key -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit
# ================================================
# === Plugins ===
# ================================================
# NOTE: Plugins MUST be at the bottom of the `.tmux.conf` file.
# The last line must also be the run `run '~/.tmux/plugins/tpm/tpm'` line.
# AFTER ADDING a plugin to the plugin list, <prefix>+I (that is a capital "i" or shift+i)
# to fetch and "INSTALL" the plugins in the list.
# To UPDATE all plugins in the list, <prefix>+u
# Reload the session (<prefix>+r or `tmux source-file ~/.tmux.conf`) and check its all good.
# All the plugins reside in the `~/.tmux/plugins/` directory.
# NOTE: This assumes github.com for a location unless using ssh.
# Other examples:
# set-option -g @plugin 'github_username/plugin_name'
# set-option -g @plugin 'github_username/plugin_name#branch'
# set-option -g @plugin '[email protected]:user/plugin'
# set-option -g @plugin '[email protected]:user/plugin'
# List of plugins
# https://github.com/tmux-plugins/list
# tpm - tmux plugin manager
set-option -g @plugin 'tmux-plugins/tpm'
# sensible - sensible options, commands, and bindings for tmux
set-option -g @plugin 'tmux-plugins/tmux-sensible'
# prefix-highlight - status bar indicator when the prefix is hit
set-option -g @plugin '[email protected]:tmux-plugins/tmux-prefix-highlight'
# set-option -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# continuum - Continuous saving of the tmux env with auto-restore (NOTE: requires tmux-resurrect, this is an automated process for the tmux-resurrect commands/process)
# set-option -g @plugin '[email protected]:tmux-plugins/tmux-continuum'
set-option -g @plugin 'tmux-plugins/tmux-continuum'
# resurrect - Persist tmux environment across reboot/restart (NOTE: this is a manual process with commands, works with tmux-continuum for automated saving)
# set-option -g @plugin '[email protected]:tmux-plugins/tmux-resurrect'
set-option -g @plugin 'tmux-plugins/tmux-resurrect'
# Alternative Options for Sourcing the above plugins (if they don't load properly - above is going direct to the git repo)
# set-option -g @plugin 'tmux-plugins/tmux-resurrect'
# set-option -g @plugin 'tmux-plugins/tmux-continuum'
# weather - neat little weather forecast app
# https://github.com/jdxcode/tmux-weather
set-option -g @plugin 'aaronpowell/tmux-weather'
# aw-watcher-tmux - activity watcher for tmux
set-option -g @plugin 'akohlbecker/aw-watcher-tmux'
# tmux-open - open a file, folder, or URL that is highlighted in the editor
set-option -g @plugin 'tmux-plugins/tmux-open'
# tmuxifier - window and session manager
set-option -g @plugin 'jimeh/tmuxifier'
## vim-tmux-navigator - works with a vim plugin to seemlessly switch between windows in tmux
## allows vim windows to be side by side with tmux panes and navigate between each using vim commands
set -g @plugin 'christoomey/vim-tmux-navigator'
## tmux-sessionx - fuzzy finder session manager window
## DEFAULT: <prefix>-O to open it
set -g @plugin 'omerxx/tmux-sessionx'
## tmux-floax - floating panes in tmux
## DEFAULT: <prefix>-p / <prefix>-P
set -g @plugin 'omerxx/tmux-floax'
## Additional Plugins - not used but want to checkout
# tmuxinator - managing and setting up complex sessions
# NOTE: ~want to get this to work~ got it working, found a new one called tmuxifier, this uses lots of ruby packages and dependencies and yaml files, tmuxifier only has a simple bash scripts with tmux commands
# set-option -g @plugin '[email protected]:tmuxinator/tmuxinator'
# set-option -g @plugin 'https://github.com/tmuxinator/tmuxinator'
# spotify - streaming music service control via command line
# NOTE: need spotify premium for this to work properly
# set-option -g @plugin 'xamut/tmux-spotify' # last updated 5 years ago
set-option -g @plugin 'robhurring/tmux-spotify' # last updated 3 mo ago
# set-option -g @plugin 'pwittchen/tmux-plugin-spotify' # last updated 3 yrs ago
# tmux autoreload - auto reload/refresh the tmux.conf file when changed
# NOTE: nice to auto-reload this file, but not needed ALL the time
# set-option -g @plugin '[email protected]:b0o/tmux-autoreload'
# tmux-newsboat - display newsboat counters in the status bar
# NOTE: need more about newsboat and a list for it
# set-option -g @plugin 'tmux-plugins/tmux-newsboat'
# tmux-ticker - add stock or crypto ticker in status bar
# NOTE: not sure what ticker or crypto to put in here yet...plus its in the status bar and I want to reserve room for other things there
# set-option -g @plugin 'Brutuski/tmux-ticker
# treemux - visual file/folder tree explorer
# NOTE: not sure about this as the explorer is in neovim and needs a seperate install and upate
# set-option -g @treemux-tree-nvim-init-file '~/.tmux/plugins/treemux/configs/treemux_init.lua'
# set-option -g @plugin 'kiyoon/treemux'
# catpuccin-tmux
# set -g @plugin 'dreamsofcode-io/catppuccin-tmux'
# tmux-piavpm
# https://github.com/Brutuski/tmux-piavpn
# checkout
# tmux-plugins/tmux-yank
# fcsonline/tmux-thumbs
# sainnhe/tmux-fzf
# wfxr/tmux-fzf-url
## allow passthrough
set -g allow-passthrough on
## Yazi docs say to add this to get image previews working properly with tmux
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# ================================================
# === Plugin Settings ===
# ================================================
set-option -g @continuum-restore 'on'
set-option -g @continuum-save-interval '60'
set-option -g @prefix_highlight_show_copy_mode 'on'
set-option -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set-option -g @prefix_highlight_copy_prompt '🔍 COPY'
set-option -g @prefix_highlight_show_sync_mode 'on'
set-option -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow'
set-option -g @prefix_highlight_sync_prompt 'SYNC'
set-option -g @prefix_highlight_show_prefix_mode 'on'
set-option -g @prefix_highlight_prefix_mode_attr '#[fg=blue]【 #[fg=black,bg=blue]' # 'fg=black,bg=blue' # default is 'fg=,bg='
set-option -g @prefix_highlight_prefix_prompt '⏲ WAIT'
# set-option -g @forecast-format %F
set-option -g @forecast-cache-duration 14400 # 4 hrs in seconds
set-option -g @forecast-location 43.200,-78.830
set-option -g @forecast-format '%t'
# ================================================
# === Status Bar ===
# ================================================
# NOTE: some taken from here https://arcolinux.com/everything-you-need-to-know-about-tmux-status-bar/
# and other stuff taken from here https://github.com/craftzdog/dotfiles-public/blob/master/.config/tmux/statusline.conf
### GENERAL ###
set-option -g display-panes-time 3000
### REDRAW ###
### Status bar redraw in seconds (default 15) - set to 6000 for weather app so it doesn't overload server with redrawing
### Redraw interval of the status bar
set-option -g status-interval 6000
### POPUP ###
# set-option -g popup-style <style>
# set-option -g popup-border-style <style>
# set-option -g popup-border-lines <same as pane border below>
### STATUS BAR SIZE ###
# NOTE: if more than 1 (on), messages will be displayed on second line
# set-option -g status "on"
# set-option -g status "on" # 2, 3, 4, 5, +
### PANE BORDERS ###
set-option -g pane-border-lines heavy # number # heavy # double # single # simple
set-option -g pane-border-status off # bottom
set-option -g pane-border-indicators both
# set-option -g pane-border-format
### NO SEPARATOR ###
# NOTE: default is a space " "
set-option -g window-status-separator ""
### BLANK / DEFAULT SPACE ###
set-option -g status-style "bg=#000000 fg=#ffffff"
### DEFAULT Window ###
set-option -g window-status-format "#[bg=#000000,fg=#41FF01]#[bg=#41FF01,fg=#000000,nobold]#I #W#[bg=#000000,fg=#41FF01,nobold]"
### CURRENT / ACTIVE ###
set-option -g window-status-current-format "#[bg=#000000,fg=#dd2211,bold]#[bg=#dd2211,fg=#ffffff,bold]#I #W #[bg=#000000,fg=#dd2211,nobold]"
### LAST ###
# NOTE: none of the BG or FG seem to work currently
set-option -g window-status-last-style "bg=#dd6600,nobold,italics"
### ACTIVITY ###
set-option -g window-status-activity-style fg=#777777,blink,italics
### BELL ###
set-option -g window-status-bell-style fg=#37733c,blink
### PREFIX ###
# sets additional information including when the prefix is touched
set-option -g status-right '#{prefix_highlight}'
### LEFT ###
# NOTE: leaving the status-left-length blank so it will try to fill the rest of the screen
# set-option -g status-left-length 80
# I want the right to always show with various statuses, but the left to show the sessions and windows and that can be adjusted
set-option -g status-left "#[bg=#000000,fg=#002eff]#[bg=#002eff,fg=#d3d7cf,bright]#S#[bg=#000000,fg=#002eff]"
### RIGHT ###
set-option -g status-right-length 75
## sets the status bar added items - Forecast, CST, EST, EuST, Date, Comp
## MAKE AN "IF" statement to load this plugin IF this message doesn't post
## "Sorry, we are running out of queries to the weather service at the moment."
# set-option -ag status-right "#[fg=#ffffff]#[bg=#ffffff,fg=#000000]#{forecast}"
set-option -ag status-right "#[fg=#ffd700]#[bg=#ffd700,fg=#000000]#(TZ='America/Denver' date +' %%H:%%M') "
set-option -ag status-right "#[fg=#0092cc]#[bg=#0092cc,fg=#ffffff]#(TZ='America/Chicago' date +' %%H:%%M') "
set-option -ag status-right "#[fg=#C60C30]#[bg=#C60C30,fg=#ffffff]#(TZ='America/New_York' date +' %%H:%%M') "
set-option -ag status-right "#[fg=#ffff00]#[bg=#ffff00,fg=#000000]#(TZ='Europe/Bucharest' date +' %%H:%%M') "
set-option -ag status-right "#[fg=#ffffff]#[bg=#ffffff,fg=#000000]#(date +' %a %Y-%m-%d') "
##
# set-option -ag status-right '#[bg=default,fg=default] #H'
## set the amount of users logged in and the current load avg per user
# set-option -g status-right '#[fg=yellow]#(uptime | cut -d “,” -f 2-)'
# ================================================
# === Key bindings ===
# ================================================
## NOTE: Putting key bindings **AFTER** plugins as the plugins have some keybindings and these may override or conflict with them.
## NOTE: C-Up and C-Down do funky things on mac OS
## Not using C-Up / C-Down in some places for this reason as the macOS keybindings for this override everything else. :(
## Noteworthy Keybindings:
## r - for resurrect in tmux-resurrect and reload config in tmux-sensible
## s - for save in tmux-resurrect
# Unbind default key bindings, we're going to override
unbind g
# unbind r
unbind R
unbind Z
unbind z
## want to use the i, j, k, l as a directional pad after leader key
## default -
## i - displays window information - remap to cap I (nothing on that)
## l - select the previously selected window (remap to C-l)
unbind h
unbind j
unbind k
unbind l
# NOTE: Shift (S-) does not work with keys sending a diffferent character such as S-n, instead use just N
unbind H
unbind J
unbind K
unbind L
#unbind S-h
#unbind S-j
#unbind S-k
#unbind S-l
unbind C-l
unbind M-l
## PANES ##
## ----- ##
## get the session and window selection menu with preview
## NOTE: the -n (lowercase n flag) means no-prefix and to bind the following key
bind-key -N "Session selection menu" -n C-w choose-tree
## Select windows 1-6
bind-key -N "Select Window 1" -n M-1 select-window -t 1
bind-key -N "Select Window 2" -n M-2 select-window -t 2
bind-key -N "Select Window 3" -n M-3 select-window -t 3
bind-key -N "Select Window 4" -n M-4 select-window -t 4
bind-key -N "Select Window 5" -n M-5 select-window -t 5
bind-key -N "Select Window 6" -n M-6 select-window -t 6
bind-key -N "Rename Session" -n M-. command-prompt -I "#W" "rename-session '%%'"
bind-key -N "Rename Window" -n M-, command-prompt -I "#W" "rename-window '%%'"
bind-key -N "TMUX Command Prompt" -n M-/ command-prompt
## REMAP / ADDITIONAL ARROW KEYS for PANE SWITCHING ##
bind-key -N "Arrow Left / Select pane Left" -r h select-pane -L
bind-key -N "Arrow Down / Select pane Down" -r j select-pane -D
bind-key -N "Arrow Up / Select pane Up" -r k select-pane -U
bind-key -N "Arrow Right / Select pane Right" -r l select-pane -R
## Split window into panes ##
bind-key -N "Split window across horizontal (divider up-down) - 'split-window -h -c'" -r _ split-window -h -c "#{pane_current_path}"
bind-key -N "Split window across vertical (divider left-right) - 'split-window -v -c'" -r | split-window -v -c "#{pane_current_path}"
# bind-key -N "Split window across horizontal (divider up-down) - 'split-window -h -c'" -r h split-window -h -c "#{pane_current_path}"
# bind-key -N "Split window across vertical (divider left-right) - 'split-window -v -c'" -r v split-window -v -c "#{pane_current_path}"
bind-key -N "Split window across horizontal (divider up-down) - 'split-window -h -c'" -r H split-window -h -c "#{pane_current_path}"
bind-key -N "Split window across vertical (divider left-right) - 'split-window -v -c'" -r V split-window -v -c "#{pane_current_path}"
## Adjust pane sizes
bind-key -N "Adjust/Move (increase/decrease) pane split to the left" -r S-Left resize-pane -L 1
bind-key -N "Adjust/Move (increase/decrease) pane split to the left" -r H resize-pane -L 1
bind-key -N "Adjust/Move (increase/decrease) pane split to the left" -r C-H resize-pane -L 5
bind-key -N "Adjust/Move (increase/decrease) pane split to the left" -r M-H resize-pane -L 15
bind-key -N "Adjust/Move (increase/decrease) pane split downwards" -r S-Down resize-pane -D 1
bind-key -N "Adjust/Move (increase/decrease) pane split downwards" -r J resize-pane -D 1
bind-key -N "Adjust/Move (increase/decrease) pane split downwards" -r C-J resize-pane -D 5
bind-key -N "Adjust/Move (increase/decrease) pane split downwards" -r M-J resize-pane -D 15
bind-key -N "Adjust/Move (increase/decrease) pane split upwards" -r S-Up resize-pane -U 1
bind-key -N "Adjust/Move (increase/decrease) pane split upwards" -r K resize-pane -U 1
bind-key -N "Adjust/Move (increase/decrease) pane split upwards" -r C-K resize-pane -U 5
bind-key -N "Adjust/Move (increase/decrease) pane split upwards" -r M-K resize-pane -U 15
bind-key -N "Adjust/Move (increase/decrease) pane split to the right" -r S-Right resize-pane -R 1
bind-key -N "Adjust/Move (increase/decrease) pane split to the right" -r L resize-pane -R 1
bind-key -N "Adjust/Move (increase/decrease) pane split to the right" -r C-L resize-pane -R 5
bind-key -N "Adjust/Move (increase/decrease) pane split to the right" -r M-L resize-pane -R 15
## Zoom pane (temp max size [to window/session] current pane) - undo by same command ##
bind-key -N "Zoom in/out current/active pane to max size of window/session (undone by same command)" + resize-pane -Z
## WINDOWS ##
## ------- ##
## REMAP / ADDITIONAL WINDOW SWITCHING ##
bind-key -N "Select Prev Window" -r C-h select-window -t :-
bind-key -N "Select Next Window" -r C-l select-window -t :+
## REMAP PREVIOUS SELECTED WINDOW
bind-key -N "(P)revious/last selected window in this current session" -r C-P last-window
## SESSIONS ##
## -------- ##
## REMAP / Additional Session Switching ##
bind-key -N "Next session" -r C-O switch-client -n
bind-key -N "(P)revious/last selected session" -r C-Y switch-client -l
bind-key -N "VPN Session" -r C-V switch-client -t VPN
bind-key -N "DOC Session" -r C-D switch-client -t DOC
## INFORMATIONAL ##
## ------------- ##
### TMUX LOGS
bind-key -N "Show TMUX log messages" \~ show-messages # NOTE: Need escape character for the tilde as it can be extracted as the home directory
### Tmux Info (Window, pane, session, date, time) - REMAP OVERRIDEN INFO (i)
# bind-key -N "Display window information" I ??? NOT sure what the prefix-i even really did, or how to reproduce it ???
## POPUPS ##
## ------ ##
### HELP POPUP ###
bind-key -N "Popup display tmux help" C-? display-popup -E -T "HELP" -h 60% -w 60% "tmux new-session -A -s 'help' 'list-keys -N'"
### SHOW/HIDE menu bar ###
bind-key -N "Toggle show/hide the status bar at the bottom" -r g set-option -g status
# bind-key -N "open current directory" o "open #{pane_current_path}"
# bind-key -N "'e'xit pane / kill pane / close pane" e kill-pane -a
### SCRATCHPAD POPUP ###
bind-key -N "Popup display terminal scratchpad" C-C display-popup -E -T "SCRATCH" "tmux new-session -A -s 'scratch' 'cd ~/'"
# NOTE: Trying to remove the menu/status from tmux for these popups to reduce clutter, but only want it on a 1-off basis ....so far no luck....
# 'tmux set-option -w status off' # && tmux set-option -w status off
### BLOG / WRITING POPUP ###
bind-key -N "Popup display blog/(w)riting pad" C-W display-popup -E -T "WRITING" -h 90% -w 90% -x 90% "tmux new-session -A -s 'writing' 'cd ~/documents/writing/ && nvim'"
### ORG POPUP ###
bind-key -N "Popup display ORG (T)asks" C-T display-popup -E -T "ORG" -h 80% -x 80% -y 80% "tmux new-session -A -s 'org' 'cd ~/documents/org/ && nvim'"
### GIT LOG POPUP ###
bind-key -N "Popup display (g)itlog" C-G display-popup -E -T "GIT_LOG" "tmux new-session -A -s 'gitlog' 'git log'"
### emoji POPUP ###
# bind-key -N "emoji" E display-popup -w 70% -h 70% -E "Emoji"
### CLIPBOARD POPUP ###
bind-key -N "Popup display clipboard" C-space display-popup -w 70% -h 70% -E "CM_OUTPUT_CLIP=1 clipmenu | yank"
bind-key -N "paste buffer" C-p paste-buffer -p
# https://github.com/xero/dotfiles/blob/main/tmux/.config/tmux/tmux.conf
# tmux clock
# set-option -g clock-mode-color #green
# enable OSC 52 clipboard
set -s set-clipboard on
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
# set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"
#
# NOTE: NOT sure what this does exactly
# unbind p
# bind p paste-buffer -p
## REFRESH ##
## ------- ##
# Make `Ctrl+A r` reload the config file and `Ctrl-A R` reload the zsh files
# 1 - refresh tmux conf
# 2 - refresh zsh (current pane)
# 3 - refresh zsh (all panes/windows)
# 4 - refresh tmux conf and zsh (current)
# 5 - refresh tmux conf and zsh (all)
## 1 - r - refresh tmux conf
bind-key -N "Reload source for the .tmux.conf file" r source-file ~/.tmux.conf \;\
display-message "____________ TMUX CONF RELOADED ____________"
## run-shell -b "tmux send 'sourcer' Enter" \;\
## display-message "++++++ ZSH RELOADED ++++++"
##bind-key -N "TEST" C-z wait-for -L display-message "one" \; wait-for -L display-message "two" \; wait-for -L display-message "three"
##bind-key -N "TEST" C-b run-shell -b "tmux send 'sourcer' Enter" \; display-message "ZSH Reloaded"
# 2 - z - refresh zsh (current)
bind-key -N "Refresh zsh source for all zsh panes" z run-shell -b "tmux send 'sourcer' Enter" \; display-message "======= ZSH RELOADED (CURRENT WINDOW) ======="
# 3 - Z - refresh zsh (all)
# bind-key -N "Refresh zsh source for all zsh panes" Z run-shell -b 'panes=`tmux list-panes -s -F "##{pane_id}"`; for pane in $panes; do tmux send -t $pane "source ~/.zshrc" Enter; done' display-message "========ZSH RELOADED (ALL WINDOWS)========"
## ~~~ TESTING REFRESH ~~~
# bind-key -N "resource the zsh" R run-shell -b "source ~/.zshrc" \; display-message "********** *********** RE-SOURCED ********** ***********"
# send "source ~/.zshrc<Enter>" to all panes in *current* session
# bind-key -N "refresh source for zsh" S-z run-shell -b 'tmux send-keys "sourcer" Enter;' ; display-message "********* ZSH Source Refreshed **********"
# bind-key -N "refresh source for zsh" Z run-shell -b "sourcer" ; display-message "=-=-=-=-=-=- refreshed zsh source -=-=-=-=-=-="
# bind-key -N "refresh source for all zsh panes" R run-shell -b 'panes=`tmux list-panes -s -F "##{pane_id}"`; for pane in $panes; do tmux send -t $pane "source ~/.zshrc" Enter; done'source-file ~/.tmux.conf \; display-message "____________TMUX CONF RELOADED____________"
# bind-key -N "reload the .tmux.conf file" r source-file ~/.tmux.conf \; display-message "____________TMUX CONF RELOADED____________"
# bind-key -N "reload the .tmux.conf file" R source-file ~/.tmux.conf \; display-message "____________RELOADED____________"
# bind-key -N "refresh source for zsh" Z run-shell -b "sourcer" ; display-message "=-=-=-=-=-=- refreshed zsh source -=-=-=-=-=-="
## below is from the sensible plugin
# tmux bind-key R run-shell " \
# tmux source-file ${tmux_config} > /dev/null; \
# tmux display-message 'Sourced ${tmux_config}!'"
# Move the window to a pane, interactive mode
bind-key -N "Move window to pane, interactive mode (horizontal)" -r m choose-window -F "#{window_index}: #{window_name}" "join-pane -h -t %%"
bind-key -N "Move window to pane, interactive mode (vertical)" -r M choose-window -F "#{window_index}: #{window_name}" "join-pane -v -t %%"
# Create new session (detached) NOTE: TMux a session (also called client) is a series of windows (tabs)
bind-key -N "New client / session / set of windows" C-a new-session
# option -N is for a note in the keybinding option -d is for detached mode (not nested within) and option -P is to print out the name of the new session / client
# tmux switch-client -t `tmux new-session -dP`
# tmux switch -t `tmux new -dP`
# open a man page in new window
# bind-key / command-prompt "split-window 'exec man %%'"
# open tmux help/shortcuts in separate pane
# bind-key -N "open tmux help/shortcuts in separate pane" C-? "split-window 'tmux list-keys'"
# ================================================
# === Copy mode, scroll and clipboard ===
# ================================================
# Use Vim shortcuts
# setw -g mode-keys vi
# Mouse and Key Usage (scrolling???) - allows clicking on links, folders, panes, windows and more
set-option -g mouse on #For tmux version 2.1 and up
# set-option -g mode-mouse on #For tmux versions < 2.1
# Sane scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -g mode-keys vi
# bind-key -T copy-mode-vi 'v' send -X begin-selection
# bind-key -T copy-mode-vi 'y' send -X copy-selection
# unbind -T copy-mode-vi MouseDragEnd1Pane
# unbind -T copy-mode-vi h
# unbind -T copy-mode-vi j
# unbind -T copy-mode-vi i
# unbind -T copy-mode-vi k
# unbind -T copy-mode-vi l
# bind-key -N "cursor-left" -T copy-mode-vi 'j' send-keys -X cursor-left
# bind-key -N "cursor-up" -T copy-mode-vi 'i' send-keys -X cursor-up
# bind-key -N "cursor-down" -T copy-mode-vi 'k' send-keys -X cursor-down
# bind-key -N "cursor-right" -T copy-mode-vi 'l' send-keys -X cursor-right
# unbind -T copy-mode h
# unbind -T copy-mode j
# unbind -T copy-mode i
# unbind -T copy-mode k
# unbind -T copy-mode l
# bind-key -N "cursor-left" -T copy-mode 'j' send-keys -X cursor-left
# bind-key -N "cursor-up" -T copy-mode 'i' send-keys -X cursor-up
# bind-key -N "cursor-down" -T copy-mode 'k' send-keys -X cursor-down
# bind-key -N "cursor-right" -T copy-mode 'l' send-keys -X cursor-right
# ================================================
# === Added TMUX Configs & Scripts ===
# ================================================
# source-file ~/.dotfiles/tmux/.tmux.organize
# ================================================
# === Initialize Plugins ===
# ================================================
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run-shell '~/.tmux/plugins/tpm/tpm'