-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
650 lines (550 loc) Β· 26 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
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
#
# 888 .d888
# 888 d88P"
# 888 888
# 888888 88888b.d88b. 888 888 888 888 .d8888b .d88b. 88888b. 888888
# 888 888 "888 "88b 888 888 `Y8bd8P' d88P" d88""88b 888 "88b 888
# 888 888 888 888 888 888 X88K 888 888 888 888 888 888
# d8b Y88b. 888 888 888 Y88b 888 .d8""8b. d8b Y88b. Y88..88P 888 888 888
# Y8P "Y888 888 888 888 "Y88888 888 888 Y8P "Y8888P "Y88P" 888 888 888
#
# -------------------------------------------------------------------------
# Version: 0.1
# File: .tmux.conf
# Source: https://github.com/devpunks
# Author: Ahmid-Ra (github.com/snuggs)
# Maintainer: devPunks <https://github.com/devpunks>
# Description: Terminal MUltipleXer configuration dotfile
# -------------------------------------------------------------------------
#
# Plugins:
# - https://github.com/tmux-plugins
#
# WIKI:
# - https://github.com/tmux/tmux/wiki
# - https://github.com/tmux/tmux/wiki/Advanced-Use
#
# Documentation:
# - https://man.openbsd.org/tmux.1
# - https://man7.org/linux/man-pages/man1/tmux.1.html
#
# Formats:
# - https://github.com/tmux/tmux/wiki/Formats
# - https://man7.org/linux/man-pages/man1/tmux.1.html#FORMATS
# - https://github.com/tmux/tmux/wiki/FAQ#how-do-i-translate--fg--bg-and--attr-options-into--style-options
#
# Cheatsheets:
# - https://devhints.io/tmux
# - https://tao-of-tmux.readthedocs.io
# - https://github.com/tmux/tmux/wiki/Control-Mode
# - https://jdhao.github.io/2021/01/25/tmux_cheatsheet
# - https://seanh.cc/2020/12/28/setting-options-in-tmux
# Issues:
# - special characters > 3.x - https://github.com/tmux/tmux/issues/1827
# - `property not found` issue - https://github.com/tmux/tmux/issues/1689
#
# run-shell
# - https://unix.stackexchange.com/q/80473/how-do-i-run-a-shell-command-from-tmux-conf
#
# display-popup
# popup-style, popup-border-style [rounded|simple|heavy|double], popup-border-lines
# - https://github.com/tmux/tmux/issues/1842
# - https://aliquote.org/post/tmux-little-hacks
# - https://blog.meain.io/2020/tmux-flating-scratch-terminal
# - https://gist.github.com/LintaoAmons/22f6184b26bd5b93d8fe9f9276f50f75
# =========================================================================
# {{{ Options
# - https://superuser.com/q/758843
# - https://superuser.com/q/1425921
# ========================================================================
# {{{ set-option -s(erver) -----------------------------------------------
%hidden BAR='BAZ'
set -g @pwd $PWD
set -g @os $OSTYPE # TODO: Fix export
set-environment -g DEVPUNKS πROCKS
set -s editor vi
# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-FocusIn_FocusOut
set -s focus-events on # (neo|g)vim - https://github.com/vim/vim/pull/7673
set -s escape-time 50 # https://unix.stackexchange.com/q/608142
set -s buffer-limit 10
set -s message-limit 100
set -s prompt-history-limit 100
set -s history-file '~/.tmux_history'
# https://unix.stackexchange.com/q/568260
# https://unix.stackexchange.com/q/1045/getting-256-colors-to-work-in-tmux
set -s default-terminal 'tmux-256color'
# https://man.openbsd.org/terminfo.5
set -u terminal-features # # UNSET See terminfo(5)
set -as terminal-features \
":hyperlinks:mouse:sync:clipboard:title:"
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
set -as terminal-features \
":256:RGB:ccolour:cstyle:ustyle:strikethrough"
# https://linux.die.net/man/1/infocmp
# https://pubs.opengroup.org/onlinepubs/7908799/xcurses/terminfo.html
set -u terminal-overrides # UNSET See infocmp(1)
set -as terminal-overrides ',*-256color*:RGB:Tc'
set -as terminal-overrides ',*:Ms' # Send to host terminal clipboard
# https://github.com/tmux/tmux/issues/2606
set -as terminal-overrides ',*:XT' # XtermTitle sequences
# https://github.com/tmux/tmux/wiki/FAQ#why-are-tmux-pane-separators-dashed-rather-than-continuous-lines
set -as terminal-overrides ',*:U8=0' # Focus tracking and UTF8 characters/borders
# https://unix.stackexchange.com/q/595978
# set -as terminal-overrides ',*:sitm@:ritm@' # Fix nCurses Italic formats
set -as terminal-overrides ',*:sitm=[3m:ritm=[0m'
# sane scrolling - https://superuser.com/a/326592
set -as terminal-overrides ',*:smcup@:rmcup@' # UP and DOWN arrows
# Hyperlink (OSC8) Support
# - https://github.com/tmux/tmux/pull/3240
# - https://github.com/tmux/tmux/pull/2890
# - https://github.com/tmux/tmux/issues/911
# - https://github.com/Alhadis/OSC8-Adoption/
# - https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
# - https://github.com/tmux/tmux/commit/cdacc12ce305ad2f3e65e2a01328a988e3200b51
set -sa terminal-overrides ',*:Hls=\033]8;id=%p1%s;%p2%s\033\\:Hlr=\033]8;;\033\\'
set -sa terminal-overrides ',*:Hla=\033]8;;%p1%s\033\\:Hlr=\033]8;;\033\\'
# }}}
# {{{ set-option -g(lobal session) ----------------------------------------
set-option -g prefix C-a # Reset Prefix to Control + a
set-option -g mode-keys vi # Use vim keybindings in copy mode
set-option -g xterm-keys on # for vim
set-option -g status-keys vi # vi movement keys
# holding arrow keys - https://blog.meain.io/2020/tmux-flating-scratch-terminal/
set-option -g repeat-time 1000
# https://stackoverflow.com/q/18760281
set-option -g history-limit 5000
set-option -g default-shell $SHELL
set-option -g default-command '' # 'echo "devPunks IDE"'
# https://stackoverflow.com/q/21947123/prevent-tmux-from-displaying-activity-in-window-n
# ittps://unix.stackexchange.com/q/78093/how-can-i-make-tmux-monitor-a-window-for-inactivity
set-option -g monitor-bell on # [on|off]
set-option -g bell-action any # [any|current|other|none]
set-option -g visual-bell on # [on|off|both]
set-option -g monitor-activity on # [on|off]
set-option -g visual-activity both # [on|off|both]
set-option -g activity-action other # [any|current|other|none]
set-option -g monitor-silence 300 # seconds
set-option -g visual-silence both # [on|off|both]
set-option -g silence-action any # [any|current|other|none]
# }}}
# {{{ set-window-option -g(lobal) -----------------------------------------
# By default, all windows in a session are constrained to the size of the
# smallest client connected to that session,
# even if both clients are looking at different windows.
# It seems that in this particular case, Screen has the better default
# where a window is only constrained in size if a smaller client
# is actively looking at it.
set-window-option -g aggressive-resize on
set-window-option -g mouse on
set-window-option -g base-index 1
set-window-option -g fill-character 'π'
set-window-option -g cursor-colour color13
set-window-option -g renumber-windows on # when window is closed
set-window-option -g allow-passthrough all # escape keys [on|off|all]
set-window-option -g clock-mode-style 24
set-window-option -g clock-mode-colour color13
set-window-option -g display-time 2000 # Notificationy display time
# Pane number display (Ctl-b)+q - https://unix.stackexchange.com/q/307696
set-window-option -g display-panes-time 4000
set-window-option -g mode-style fg=colour13,reverse,bold # selection highlighting/prefix w (window list)
set-window-option -g window-style fg=colour236,dim
set-window-option -g window-active-style fg=green,bg=colour232
set-window-option -g pane-base-index 1
set-window-option -g pane-border-status top
set-window-option -g pane-border-format \
"οΌ #{?pane_active,π, }#[default]"
set-window-option -ag pane-border-format \
"#[fg=grey,bold]#{?window_zoomed_flag, π,οΉ#{pane_index}} #[default]"
set-window-option -ag pane-border-format \
"π#[dim,nounderscore,noitalics]#{pane_width}β#{pane_height}#[default] "
set-window-option -ag pane-border-format "#{?#{==:#{pane_mode},copy-mode},π,π»}#[underscore,italics]#{pane_tty} "
set-window-option -ag pane-border-format \
"#[reverse]π#[italics]β―/#( echo '#{pane_current_path}' | rev | cut -d'/' -f-3 | rev )/#[default] "
set-window-option -ag pane-border-format \
"#[fg=grey,bold]#{pane_current_command}#[default] οΌ"
set-window-option -g pane-border-lines heavy # [single|double|heavy|number]
set-window-option -g pane-border-indicators both # [colour|arrows|both]
set-window-option -g display-panes-colour color5 # prefix q panes list
set-window-option -g display-panes-active-colour color13 # prefix q panes list
set-window-option -g pane-border-style fg=brightblack,bold,bg=terminal
set-window-option -g pane-active-border-style fg=magenta,bold,bg=terminal
# }}}
# }}}
# =========================================================================
# {{{ Status Bar
# - https://tao-of-tmux.readthedocs.io/en/latest/manuscript/09-status-bar.html
# Formats:
# - https://github.com/tmux/tmux/wiki/Formats
# =========================================================================
set-window-option -g status-interval 1
set-window-option -g status-justify left # [left|(absolute-)centre|right]
set-window-option -g status-position bottom # [top|bottom]
set-window-option -g message-line 0 # row position (0-4)
set-window-option -g message-style fg=brightmagenta,bold,bg=colour234
set-window-option -g message-command-style fg=brightmagenta,dim,italics,bg=colour234
# Titles (window number, program name, active (or not)
# printf '\033]2;title\007' # PRINTS TITLE TO HEADER
# - https://unix.stackexchange.com/q/60968/tmux-bottom-bar-color-change/60969
# - https://stackoverflow.com/q/16624752/tmux-how-to-configure-tmux-to-display-the-current-working-directory-of-a-pane-o
set-window-option -g set-titles on
set-window-option -g set-titles-string "#{?session_name,#{session_name},#H}"
# Multiple Status Lines
set-window-option -g status 5 # lines (on|0-5|off)
set-window-option -g status-bg colour234
set-window-option -g status-fg magenta
# set-window-option -g status-format[0] '* Window tabs *' # 0th line
set-window-option -g status-format[1] \
"PWDβ#[bold,italics]#{pane_current_path}/#[default] β
βπ§Messageββββββ
888 Pass ββ888 Fail β²βΌπΊπ»β¬β¬βͺβ«π΅π΄βππ¨β β‘β ββ’β²π₯‘π¦Bundle" # https://symbl.cc/en/
set-window-option -g status-format[2] \
"#[bold]#{window_active_clients}#[nobold] VIEWER(S)π₯ γ π€#[bold]#{user}#[nobold] γ π»#{W:#{window_active_clients_list}}"
set-window-option -g status-format[3] \
"PIDπ#[dim]#{pid}#[nodim] "
set-window-option -ag status-format[3] \
"SOCKETπ#[dim,underscore]#{=|-32|β―:socket_path} #[default] "
set-window-option -ag status-format[3] \
"TICKERπ#[fg=red,bold,reverse] #{TOKEN} $#{PRICE} #[default] "
set-window-option -g status-format[4] \
"#[bg=colour234]UPTIMEπ#[bold]β€TMUX#[nobold]#[dim,italics] #{t:start_time}#[default] #[bold]β€#( uname -o ) #( uname -s )#[default]#[dim,italics]#( uptime )#[default]"
# https://superuser.com/q/1708413/how-to-automatically-rename-tmux-window-to-an-aliased-command
set-window-option -g automatic-rename on # Automatically set window title
# Use PROMPT_COMMANND to prevent lag - https://that.guru/blog/automatically-set-tmux-window-name
set-window-option -g automatic-rename-format \
"#{?window_name,#{window_name},Window οΉ#{window_index}}"
set-window-option -g window-status-separator '|'
set-window-option -g window-status-format \
"#[nobold,noreverse] #{?window_silence_flag,π€,}#{?#{window_bell_flag},π,}#{?window_activity_flag,π’,}"
set-window-option -ag window-status-format \
" #{?window_name,#{window_name},οΉ#{window_index}} #{?window_zoomed_flag,π,β#{window_panes}}β#[default]"
set-window-option -g window-status-current-format \
"#[bold,reverse] π#{?window_silence_flag,π€,}#{?#{window_bell_flag},π,#{?window_activity_flag,π’,}}"
set-window-option -ag window-status-current-format \
"#{?window_name, #{window_name}, οΉ#{window_index}} #{?window_zoomed_flag,π,β#{window_panes}}β#[default]"
set-window-option -g status-left-length 46
set-window-option -g status-left \
"#{?mouse,π, }|"
set-window-option -ag status-left \
"#[fg=default#,bold] #{?session_name,#{=|16|β¦;p17:session_name},#H}#[default]"
set-window-option -ag status-left \
"|#[fg=default,dim] #{client_width}β#{client_height} #[default]"
set-window-option -ag status-left \
"| #{p2:cursor_character}"
set-window-option -ag status-left \
"|#{?client_prefix,#[bg=white#,bold#,reverse],#[dim]} #( tmux show -gv prefix | sed 's/C-/\^/' ) #[default]"
# TODO: #{?pane_mode,copy-mode,}
set-window-option -ag status-left \
"#{?pane_in_mode,#[reverse#,bold]|π#{rectangle_toggle}#{search_present}#{selection_active}|#[default],|π»|}"
set-window-option -g status-right-length 47
set-window-option -g status-right \
"#[reverse] π %H:%M #[italics]%a. %b. %d #[default]"
set-window-option -ag status-right \
"#[fg=red,bold,reverse] #{TOKEN} $#{PRICE} #[default]"
# Window tab notification styles (overriden by *-format)
# set-window-option -g status-style fg=default
# set-window-option -g status-left-style fg=default
# set-window-option -g status-right-style fg=default
# set-window-option -g window-status-bell-style fg=default
# set-window-option -g window-status-activity-style fg=default
# }}}
#==========================================================================
# {{{ Unbindings
#==========================================================================
unbind C-b # unbind default leader key
unbind '[' # copy mode bound to escape key
unbind '(' # unbind kill previous session
unbind '"' # unbind horizontal split
unbind '%' # unbind vertical split
# }}}
#==========================================================================
# {{{ Copy & πPasta
# - https://man.openbsd.org/tmux.1#BUFFERS
# - https://waylonwalker.com/tmux-copy-mode
# - https://wiki.archlinux.org/title/Clipboard
# - https://github.com/tmux/tmux/wiki/Clipboard
# - https://en.m.wikipedia.org/wiki/Clipboard_(computing)
# - https://askubuntu.com/q/705620/xclip-vs-xsel
# - https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
# - http://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future
# - https://cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/
# - https://rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting/
# - https://freecodecamp.org/news/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b/
#
# - X11 Forwarding to remote server
# - printf "\033]52;c;Y29weXBhc3RhIQ==\a\n" # copypasta! OC2 sequence
# - https://askubuntu.com/a/305681
# - https://stackoverflow.com/q/1152362
# - https://sunaku.github.io/tmux-yank-osc52.html
# - https://unix.stackexchange.com/q/56477
# - https://unix.stackexchange.com/q/572874
# - https://chromium.googlesource.com/apps/libapps/+/master/nassh/doc/FAQ.md#Is-OSC-52-aka-clipboard-operations_supported
#
# Testing for Darwin (Mac OSX):
# if-shell 'test "$(uname -s)" = Darwin' 'set-option -g default-command "echo default"'
#==========================================================================
set set-clipboard on # [on|external]
bind-key -N '[Escape] entering copy-mode' \
Escape copy-mode # replaces <prefix>+[ \; \
display-message '[Escape] entering copy-mode'
bind-key -n -N 'Mouse double click 1 copy-mode' \
-T copy-mode DoubleClick1Pane \; \
display-message 'Mouse double click 1 copy-mode'
# bind-key -N 'ctrl+c to send to clipboard' \
# 'C-c' run "tmux save-buffer - | xclip -i -selection clipboard"
unbind -T copy-mode-vi v
bind-key -n -N '(v)isual copy-mode selection' \
-T copy-mode-vi v send-keys -X begin-selection \; \
display-message '(v)isual copy-mode selection'
unbind -T copy-mode-vi V
bind-key -n -N '(S-v)isual line copy-mode selection' \
-T copy-mode-vi V send-keys -X begin-selection \; \
display-message '(S-v)isual line copy-mode selection'
unbind -T copy-mode-vi C-v
bind-key -n -N '(C-v)isual rectancle block copy-mode selection' \
-T copy-mode-vi C-v send-keys -X begin-selection \; \
send-keys -X rectangle-toggle \; \
display-message '(C-v)isual rectancle block copy-mode selection'
# bind-key -N "ctrl+v to paste from clipboard" \
# 'C-v' run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
unbind -T copy-mode y
bind-key -N "`y` to copy pipe selection and exit" \
-T copy-mode-vi y send-keys -X copy-pipe-and-cancel
# bind-key -N "" \
# -T copy-mode-vi y send -X copy-pipe "reattach-to-user-namespace termux-clipboard-set"
# copy-pipe "reattach-to-user-namespace pbcopy"
unbind -T copy-mode Enter
bind-key -N "[Enter] to copy pipe selection and exit" \
-T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "tmux list-buffers" # "pbcopy"
# bind-key -N "" \
# -T copy-mode-vi Enter copy-pipe "reattach-to-user-namespace pbcopy"\; send X copy-pipe-and-cancel\;
# Copy mode copy should also copy it to the clipboard as well.
# bind -N "" \
# -T copy-mode-vi Enter send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -selection clipboard > /dev/null"
# paste from right click
# bind-key -N "" -n MouseDown3Pane run " \
# X=$(xclip -o -selection clipboard); \
# tmux paste-buffer -p; Mouse\
# tmux set-buffer \"$X\"; \
# tmux paste-buffer -p; Mouse\
# tmux display-message 'pasted!' \
# tmux diplay-message 'DEVPUNKS'
# System clipboard integration (only applicable when you have an X server running)
# bind -N "" \
# -T copy-mode-vi 'M-y' send -X copy-pipe "xclip -i -selection p -f | xclip -i -selection c" \; display-message "copied to system clipboard"
# Mouse selection copy to clipboard right away, in addition to the default action.
# bind -N "" \
# -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -selection clipboard > /dev/null"
# Right click to paste from the clipboard
# Change MouseDown3Pane to MouseDown2Pane for middle click.
# bind-key -n MouseDown3Pane \
# run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux p
# }}}
#==========================================================================
# {{{ Bindings
# - List All - <prefix>:?
# - List Keys - list-keys [-aNT]
# - https://unix.stackexchange.com/q/140007/what-are-valid-keys-for-tmux
# - https://man7.org/linux/man-pages/man1/tmux.1.html#DEFAULT_KEY_BINDINGS
#
# Shortcuts:
# <Prefix> - C-a
# <Prefix> c - New Window
# <Prefix> d - Detach
# <Prefix> f - Find Window
# <Prefix> i - Info
# <Prefix> n - Next
# <Prefix> p - Prev
# <Prefix> q - Panes
# <Prefix> s - Sessions
# <Prefix> t - Time
# <Prefix> w - Windows
# <Prefix> z - Zoom
#
#==========================================================================
bind-key -N 'Remap <prefix> to "a"' \
'a' { send-prefix } # for nested tmux sessions
bind-key -N 'Send C-a for internal pane capture' \
C-a { send-key C-a } # https://stackoverflow.com/q/9684115
bind-key -N 'Semi-colon (;) to command prompt (like vim)' \
';' { command-prompt } # semi-colon
# Kill
bind-key -N 'Kill current pane' 9 kill-pane
bind-key -N 'Kill current window' C-9 kill-window -t=
# TODO: 'C-(' not working
bind-key -N 'Kill current session' 'C-(' send -X kill-session
# Reload ~/.tmux.conf
bind-key -N 'Reload source file ($HOME/.tmux.conf)' \
C-r source-file -v "${HOME}/.tmux.conf" \
display-message "Source file loaded! (#{config_files})"
# Rename Session
bind-key -N 'Rename Session' \
'R' command-prompt \
-p '#[reverse] RENAME SESSION π²#[noreverse]' \
-I "#S" { rename-session '%%' }
# {{{ status --------------------------------------------------------------
# Click to select window from list
bind-key -N 'Select-window with mouse' \
-n MouseDown1Status { select-window -t= }
# Drag the window list to re-order tabs
# - https://github.com/tmux/tmux/issues/656#issuecomment-56983404
bind-key -N 'Drag swap-window order with mouse' \
-n MouseDrag1Status { swap-window -d -t= }
# Mouse Up 1
bind-key -N 'Mouse Up 1 on status' \
-n MouseUp1Status { display-message 'Mouse Up 1' }
# Double click on the window list to open a new window
bind-key -N 'New Window (mouse)' \
-n DoubleClick1Status command-prompt \
-p '#[reverse] NEW WINDOW π²#[noreverse],#[reverse] PATH #[noreverse] π' \
-I ',#{pane_current_path}/' \
{
display-message 'New Window %1 @ %2'
new-window -S -n '%1' -e 'OLDPWD=%2'
# TODO: don't sleep π΄
run-shell 'sleep 1s'
send-keys 'cd -' Enter
}
# Status Left -------------------------------------------------------------
bind-key -N "StatusLeft MouseDown l" \
-n MouseDown1StatusLeft \
display-message "StatusLeft MouseDown l Click"
bind-key -N "StatusLeft DoubleClick l" \
-n DoubleClick1StatusLeft \
display-message "StatusLeft DoubleClick l"
bind-key -N "StatusLeft TripleClick l" \
-n TripleClick1StatusLeft \
display-message "StatusLeft TripleClick l"
# Status Right ------------------------------------------------------------
bind-key -N "StatusRight MouseDown l" \
-n MouseDown1StatusRight \
display-message "StatusRight MouseDown l"
bind-key -N "StatusRight DoubleClick l" \
-n DoubleClick1StatusRight \
display-message "StatusRight DoubleClick l"
bind-key -N "StatusRight TripleClick l" \
-n TripleClick1StatusRight \
display-message "StatusRight TripleClick l"
# }}}
# {{{ panes ---------------------------------------------------------------
bind-key -N 'Press [Enter] for (-Z)oom toggle' \
Enter { resize-pane -Z }
bind-key -N 'Double Click 1 Pane' \
-n DoubleClick1Pane { display-message 'DoubleClick 1 Pane' }
# TODO: Not working as expected. How to test?
# bind-key -N 'Drag swap-pane order with mouse' \
# -n MouseDrag1Pane { swap-pane -Z -d -t= }
# vim motion
bind-key -r -N 'Select pane UP' k select-pane -U
bind-key -r -N 'Select pane DOWN' j select-pane -D
bind-key -r -N 'Select pane LEFT' h select-pane -L
bind-key -r -N 'Select pane RIGHT' l select-pane -R
# resizing
bind-key -r -N 'Resize pane Up' C-k resize-pane -U 7
bind-key -r -N 'Resize pane Down' C-j resize-pane -D 7
bind-key -r -N 'Resize pane Left' C-h resize-pane -L 7
bind-key -r -N 'Resize pane Right' C-l resize-pane -R 7
# }}}
# {{{ windows -------------------------------------------------------------
bind-key -N 'Next Window' C-down next
bind-key -N 'Next Window' C-right next
bind-key -N 'Previous Window' C-up prev
bind-key -N 'Previous Window' C-left prev
bind-key -N 'Rename Window' \
'r' command-prompt -p '#[reverse] RENAME WINDOW π²#[noreverse]' \
-I "#W" { rename-window '%%' }
bind-key -N 'New Window' \
C-n command-prompt -T 'window-target' \
-p '#[reverse] NEW WINDOW π²#[noreverse],#[reverse] PATH #[noreverse] π' \
-I ',#{pane_current_path}/' \
{
display-message '%1 @ %2'
new-window -S -n '%1' -e 'OLDPWD=%2'
# TODO: don't sleep π΄
run-shell 'sleep 1s'
send-keys 'cd -' Enter
}
# MOUSE WHEEL TO CHANGE WINDOW TABS - https://wbk.one/%2Farticle%2F15%2Ftmux-mouse-support
# bind-key -n -N 'Wheel up scroll' WheelUp \; display-message 'Wheel scroll up'
# bind-key -n -N 'Wheel down scroll' WheelDown \; display-message 'Wheel scroll down'
# bind-key -n -N 'Mouse click 2' MouseClick2Status \; display-message 'mouse 2 click'
# bind-key -n -N 'Mouse click 3' MouseClick3Status \; display-message 'mouse 3 click'
# }}}
# {{{ layouts -------------------------------------------------------------
bind-key -N 'Rotate window' -r \
'M-r' rotate-window
bind-key -N 'Split window pane (vertical)' \
'-' command-prompt \
-p '#[reverse] PATH #[noreverse] π' \
-I '#{pane_current_path}/' \
{
display-message '%%'
split-window -v -e 'OLDPWD=%%'
# TODO: don't sleep π΄
run-shell 'sleep 1s'
send-keys 'cd -' Enter
}
bind-key -N 'Split window pane (horizontal)' \
'|' command-prompt -p '#[reverse] PATH π#[noreverse]' \
-I '#{pane_current_path}/' \
{
display-message '%%'
split-window -h -e 'OLDPWD=%%'
# TODO: don't sleep π΄
run-shell 'sleep 1s'
send-keys 'cd -' Enter
}
# prevent need to press [SHIFT]
bind-key -N 'Split window pane (horizontal)' \
'\' command-prompt -p '#[reverse] PATH π#[noreverse]' \
-I '#{pane_current_path}/' \
{
display-message '%%'
split-window -h -e 'OLDPWD=%%'
# TODO: don't sleep π΄
run-shell 'sleep 1s'
send-keys 'cd -' Enter
}
# }}}
# }}}
#==========================================================================
# {{{ Hooks
#==========================================================================
set-hook -g session-created {
display-message -d 1000 ' β
Session Created'
} # session-created
set-hook -g pane-set-clipboard {
display -d 1000 ' π Copied to clipboard'
} # pane-set-clipboard
set-hook -g client-attached {
display-message -d 1000 ' π£ Client Attached'
display-message -d 1000 ' π’ #{BAR} #{@os} #{@pwd} #{PREFIX} #{DEVPUNKS}'
display-menu -t 1 -T "devPunksπcrypto: Select Token" -x 0 -y 0 "π€ππ€ BTC" z lsp
} # client-attached
set-hook -g alert-activity {
display-message -d 1000 ' π’ Activity #{hook_window_name}#{hook_window}|#{hook_pane}'
} # alert-activity
set-hook -g alert-silence {
display-message -d 1000 ' π€ #{hook_window_name}#{hook_window}|#{hook_pane} is sleeping since #{t:client_activity} π€'
} # alert-silence
set-hook -g alert-bell { # https://unix.stackexchange.com/q/448649
display-message -d 1000 ' π Ding Dong #{hook_window}|#{hook_window_name}|#{hook_pane}'
set status-left-style bg=white
# TODO: don't sleep π΄
run-shell 'sleep 1s'
run -b -d.1 -C {
set -u status-left-style
} # run
} # alert-bell
set-hook -g pane-focus-in {
if -F '#{==:#{window_zoomed_flag},1}' { set status on }{ set -u status }
display-message -d 1000 ' π Pane focus in #{window_name}@#{window_index}οΉ#{pane_index}'
} # pane-focus-in
set-hook -g pane-focus-out { }
set-hook -g after-resize-pane {
if -F '#{==:#{window_zoomed_flag},1}' { set status on }{ set -u status }
display -d 1000 ' π Resized pane #{window_name}@#{window_index}οΉ#{pane_index}'
} # after-resize-pane
set-hook -g session-window-changed {
if -F '#{==:#{window_zoomed_flag},1}' { set status on }{ set -u status }
display-message -d 1000 ' π Session Window changed #{hook_session_name}#{hook_session} #{window_name}@#{window_index}'
} # session-window-changed
# }}}
# vim: foldmethod=marker