tenseleyflow/ndotfiles / 51e4b87

Browse files

tmux things

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
51e4b87e0509acbf71885b281faf1a9e6d2c949a
Parents
c6c9cac
Tree
c08ed77

6 changed files

StatusFile+-
A tmux/.tmux.conf 19 0
A tmux/.tmux.d/10-options.conf 13 0
A tmux/.tmux.d/20-keys.conf 103 0
A tmux/.tmux.d/30-mouse.conf 30 0
A tmux/.tmux.d/40-status-theme.conf 30 0
A tmux/.tmux.d/50-plugins.conf 23 0
tmux/.tmux.confadded
@@ -0,0 +1,19 @@
1
+##### entrypoint #####
2
+# Keep this file small; just core env + includes.
3
+
4
+# Truecolor + term
5
+set -g default-terminal "tmux-256color"
6
+set -as terminal-overrides ",*:Tc"
7
+
8
+# Sensible reload
9
+bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
10
+
11
+# Include modular pieces (quiet if missing)
12
+source-file -q ~/.tmux.d/10-options.conf
13
+source-file -q ~/.tmux.d/20-keys.conf
14
+source-file -q ~/.tmux.d/30-mouse.conf
15
+source-file -q ~/.tmux.d/40-status-theme.conf
16
+source-file -q ~/.tmux.d/50-plugins.conf
17
+
18
+# Local, untracked tweaks
19
+source-file -q ~/.tmux.local.conf
tmux/.tmux.d/10-options.confadded
@@ -0,0 +1,13 @@
1
+##### options #####
2
+set -g mouse on
3
+set -g history-limit 100000
4
+setw -g mode-keys vi
5
+set -g status-keys vi
6
+set -g focus-events on
7
+set -g renumber-windows on
8
+set -g base-index 1
9
+setw -g pane-base-index 1
10
+set -g escape-time 10
11
+set -g set-clipboard on
12
+set -g xterm-keys on
13
+set -g allow-rename off
tmux/.tmux.d/20-keys.confadded
@@ -0,0 +1,103 @@
1
+##### keybinds (+ global ON/OFF like Zellij’s Ctrl-G) #####
2
+
3
+# Global switch: when OFF, your custom binds are paused and keys pass to apps.
4
+set -g @ui_binds on
5
+
6
+# Toggle (Ctrl+g) — refresh status immediately so colors/badge update
7
+unbind -n C-g
8
+bind   -n C-g if-shell -F '#{==:#{@ui_binds},on}' \
9
+  "set -g @ui_binds off; refresh-client -S; display-message 'User binds: OFF (Ctrl+g to re-enable)'" \
10
+  "set -g @ui_binds on;  refresh-client -S; display-message 'User binds: ON'"
11
+
12
+# Helper pattern for guarded binds:
13
+#   unbind -n <KEY>
14
+#   bind   -n <KEY> if-shell -F '#{==:#{@ui_binds},on}' "<tmux action>" "send-keys <KEY>"
15
+
16
+##### Tabs / windows #####
17
+
18
+# New tab
19
+unbind -n C-t
20
+bind   -n C-t if-shell -F '#{==:#{@ui_binds},on}' \
21
+  "new-window" \
22
+  "send-keys C-t"
23
+
24
+# Close tab (confirm)
25
+unbind -n C-w
26
+bind   -n C-w if-shell -F '#{==:#{@ui_binds},on}' \
27
+  "confirm-before -p 'Kill window #W? (y/n)' kill-window" \
28
+  "send-keys C-w"
29
+
30
+# Previous / Next tab
31
+unbind -n C-M-Left
32
+bind   -n C-M-Left if-shell -F '#{==:#{@ui_binds},on}' \
33
+  "previous-window" \
34
+  "send-keys C-M-Left"
35
+
36
+unbind -n C-M-Right
37
+bind   -n C-M-Right if-shell -F '#{==:#{@ui_binds},on}' \
38
+  "next-window" \
39
+  "send-keys C-M-Right"
40
+
41
+##### Panes / splits #####
42
+
43
+# Split left/right (vertical divider)
44
+unbind -n M-\\
45
+bind   -n M-\\ if-shell -F '#{==:#{@ui_binds},on}' \
46
+  "split-window -h" \
47
+  "send-keys M-\\"
48
+
49
+# Split top/bottom (horizontal divider)
50
+unbind -n "M-|"
51
+bind   -n "M-|" if-shell -F '#{==:#{@ui_binds},on}' \
52
+  "split-window -v" \
53
+  "send-keys M-\|"
54
+
55
+# Close pane (confirm)
56
+unbind -n C-S-x
57
+bind   -n C-S-x if-shell -F '#{==:#{@ui_binds},on}' \
58
+  "confirm-before -p 'Kill pane #P? (y/n)' kill-pane" \
59
+  "send-keys C-x"   # tmux can’t reliably synthesize C-S-x; pass through C-x
60
+
61
+##### Pane focus #####
62
+
63
+unbind -n C-M-S-Left
64
+bind   -n C-M-S-Left if-shell -F '#{==:#{@ui_binds},on}' \
65
+  "select-pane -L" \
66
+  "send-keys C-M-S-Left"
67
+
68
+unbind -n C-M-S-Right
69
+bind   -n C-M-S-Right if-shell -F '#{==:#{@ui_binds},on}' \
70
+  "select-pane -R" \
71
+  "send-keys C-M-S-Right"
72
+
73
+unbind -n C-M-S-Up
74
+bind   -n C-M-S-Up if-shell -F '#{==:#{@ui_binds},on}' \
75
+  "select-pane -U" \
76
+  "send-keys C-M-S-Up"
77
+
78
+unbind -n C-M-S-Down
79
+bind   -n C-M-S-Down if-shell -F '#{==:#{@ui_binds},on}' \
80
+  "select-pane -D" \
81
+  "send-keys C-M-S-Down"
82
+
83
+##### Pane resize #####
84
+
85
+unbind -n M-S-Left
86
+bind   -n M-S-Left if-shell -F '#{==:#{@ui_binds},on}' \
87
+  "resize-pane -L 5" \
88
+  "send-keys M-S-Left"
89
+
90
+unbind -n M-S-Right
91
+bind   -n M-S-Right if-shell -F '#{==:#{@ui_binds},on}' \
92
+  "resize-pane -R 5" \
93
+  "send-keys M-S-Right"
94
+
95
+unbind -n M-S-Up
96
+bind   -n M-S-Up if-shell -F '#{==:#{@ui_binds},on}' \
97
+  "resize-pane -U 2" \
98
+  "send-keys M-S-Up"
99
+
100
+unbind -n M-S-Down
101
+bind   -n M-S-Down if-shell -F '#{==:#{@ui_binds},on}' \
102
+  "resize-pane -D 2" \
103
+  "send-keys M-S-Down"
tmux/.tmux.d/30-mouse.confadded
@@ -0,0 +1,30 @@
1
+##### mouse (works with editors; cooperates with Ctrl-g) #####
2
+
3
+# When @ui_binds = off → always pass mouse to app.
4
+# When @ui_binds = on:
5
+#   - alt-screen apps (micro/vim/less/man/htop) get the mouse
6
+#   - in a plain shell, drag creates tmux selection with clear highlight
7
+
8
+# Strong selection highlight
9
+setw -g mode-style "bg=#7bd88f,fg=#0b0b0b,bold"
10
+
11
+# Clean slate
12
+unbind -n MouseDown1Pane
13
+unbind -n MouseDrag1Pane
14
+unbind -n MouseUp1Pane
15
+
16
+# Mouse down
17
+bind -n MouseDown1Pane if -F '#{||:#{==:#{@ui_binds},off},#{alternate_on}}' \
18
+  'send-keys -M' \
19
+  'select-pane -t='
20
+
21
+# Drag
22
+bind -n MouseDrag1Pane if -F "#{pane_in_mode}" \
23
+  "send-keys -X begin-selection" \
24
+  "if -F '#{||:#{==:#{@ui_binds},off},#{alternate_on}}' 'send-keys -M' 'copy-mode -M'"
25
+
26
+# Extend selection while in copy-mode
27
+bind -T copy-mode-vi MouseDrag1Pane send-keys -X begin-selection
28
+
29
+# Mouse up
30
+bind -n MouseUp1Pane if -F '#{||:#{==:#{@ui_binds},off},#{alternate_on}}' 'send-keys -M'
tmux/.tmux.d/40-status-theme.confadded
@@ -0,0 +1,30 @@
1
+##### theme / status #####
2
+set -g status-position top
3
+set -g status-interval 2
4
+set -g status-justify centre
5
+
6
+set -g status-style "bg=default,fg=#b8c0cc"
7
+set -g message-style "bg=#1f2430,fg=#e5e9f0"
8
+set -g message-command-style "bg=#1f2430,fg=#e5e9f0"
9
+set -g pane-border-style "fg=#4a5162"
10
+set -g pane-active-border-style "fg=#7bd88f"
11
+set -g display-panes-colour "#4a5162"
12
+set -g display-panes-active-colour "#7bd88f"
13
+
14
+# Active tab (window) turns red when @ui_binds = off; otherwise green.
15
+# Keep commas out of the conditional branches by switching only the bg color.
16
+setw -g window-status-current-format '#[fg=#0b0b0b,bold]#[bg=#{?#{==:#{@ui_binds},off},#e05f5f,#7bd88f}] #I:#W #[default]'
17
+
18
+# Inactive tabs
19
+setw -g window-status-format         " #[fg=#8b94a6]#I:#W "
20
+setw -g window-status-separator " "
21
+
22
+set -g status-left-length 40
23
+set -g status-right-length 120
24
+set -g status-left  "#[bold]#S #[fg=#4a5162]|#[default] #H"
25
+
26
+# Right status: PREFIX badge + optional BINDS OFF badge + time/date
27
+set -g status-right '#{?client_prefix,#[reverse] PREFIX #[default] ,}#{?#{==:#{@ui_binds},off},#[bg=#e05f5f]#[fg=#0b0b0b] BINDS OFF #[default],} %R  %F (%a)'
28
+
29
+# Pane border info (tmux ≥ 3.2)
30
+setw -g pane-border-format " #[fg=#8b94a6]#P#[default] #{?pane_active,#[bold]#{pane_current_command},#{pane_current_command}} "
tmux/.tmux.d/50-plugins.confadded
@@ -0,0 +1,23 @@
1
+##### plugins (declare first, run TPM last) #####
2
+
3
+# tmux-yank: copy without snapping back; use Wayland clipboard
4
+set -g @yank_action 'copy-pipe'
5
+set -g @yank_selection_mouse 'clipboard'
6
+set -g @override_copy_command 'wl-copy'
7
+
8
+# Resurrect auto-restore
9
+set -g @continuum-restore 'on'
10
+
11
+# Plugins
12
+set -g @plugin 'tmux-plugins/tpm'
13
+set -g @plugin 'tmux-plugins/tmux-yank'
14
+set -g @plugin 'tmux-plugins/tmux-copycat'
15
+set -g @plugin 'tmux-plugins/tmux-open'
16
+set -g @plugin 'sainnhe/tmux-fzf'
17
+set -g @plugin 'junegunn/tmux-fzf-url'
18
+set -g @plugin 'tmux-plugins/tmux-resurrect'
19
+set -g @plugin 'tmux-plugins/tmux-continuum'
20
+set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
21
+
22
+# TPM init (must be last in this file)
23
+run '~/.tmux/plugins/tpm/tpm'