-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_tmux.conf
More file actions
265 lines (209 loc) · 11.9 KB
/
dot_tmux.conf
File metadata and controls
265 lines (209 loc) · 11.9 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
# ══════════════════════════════════════════════════════════════════════════════
# TMUX CONFIGURATION
# ══════════════════════════════════════════════════════════════════════════════
# ──────────────────────────────────────────────────────────────────────────────
# Core Settings
# ──────────────────────────────────────────────────────────────────────────────
# True color support
set -g default-terminal "tmux-256color"
set -as terminal-features ",*:RGB"
# Extended key support (more key combinations)
set -s extended-keys on
# Faster command sequences (no delay for escape key)
set -s escape-time 0
# Larger scrollback buffer
set -g history-limit 50000
# Start window/pane numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when one is closed
set -g renumber-windows on
# Enable focus events (for vim/neovim)
set -g focus-events on
# Aggressive resize (useful when multiple clients)
setw -g aggressive-resize on
# ──────────────────────────────────────────────────────────────────────────────
# Key Bindings
# ──────────────────────────────────────────────────────────────────────────────
# Change prefix from C-b to C-a (easier to reach)
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Vi mode for copy/paste
set -g mode-keys vi
set -g status-keys vi
# Reload config with prefix + r
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
# Split panes with | and - (more intuitive)
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Override default split bindings to open in same directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -hc "#{pane_current_path}"
# New window in same directory
bind c new-window -c "#{pane_current_path}"
# Arrow key navigation for panes (no prefix needed)
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift + Arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Ctrl + Shift + Arrow to reorder windows
bind -n C-S-Left swap-window -t -1\; select-window -t -1
bind -n C-S-Right swap-window -t +1\; select-window -t +1
# Resize panes with prefix + Arrow (repeatable)
bind -r Left resize-pane -L 5
bind -r Down resize-pane -D 5
bind -r Up resize-pane -U 5
bind -r Right resize-pane -R 5
# Quick pane cycling with prefix + Tab
bind Tab last-pane
# Vi-style copy mode bindings
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi C-v send -X rectangle-toggle
# Easier copy mode entry
bind Escape copy-mode
# ──────────────────────────────────────────────────────────────────────────────
# Mouse Support
# ──────────────────────────────────────────────────────────────────────────────
set -g mouse on
# Don't clear selection on mouse release
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear
# ──────────────────────────────────────────────────────────────────────────────
# Visual Styling
# ──────────────────────────────────────────────────────────────────────────────
# Status bar position
set -g status-position top
# Status bar colors and style
set -g status-style 'bg=#1e1e2e,fg=#cdd6f4'
# Status bar left side
set -g status-left-length 40
set -g status-left '#{?client_prefix,#[bg=#f38ba8 fg=#1e1e2e bold],#[bg=#89b4fa fg=#1e1e2e bold]} #{session_name} #[bg=#1e1e2e] '
# Status bar right side
set -g status-right-length 80
set -g status-right '#[fg=#89dceb]#{continuum_status}#[fg=#cdd6f4] | #[fg=#a6e3a1]%H:%M #[fg=#f9e2af]%d-%b-%y '
# Window status format
set -g window-status-format ' #I:#W '
set -g window-status-current-format '#[fg=#f5c2e7 bold] #I:#W '
# Window status separator
set -g window-status-separator ''
# Active window highlighting
set -g window-status-current-style 'fg=#cba6f7,bold'
# Window with activity alert
setw -g monitor-activity on
set -g visual-activity off
set -g window-status-activity-style 'fg=#fab387,bold'
# Pane borders
set -g pane-border-status top
set -g pane-border-format ' #{pane_title} '
set -g pane-border-style 'fg=#313244'
set -g pane-active-border-style 'fg=#cba6f7,bold'
# Message styling
set -g message-style 'bg=#89b4fa,fg=#1e1e2e,bold'
set -g message-command-style 'bg=#f9e2af,fg=#1e1e2e'
# Clock mode colors
setw -g clock-mode-colour '#89b4fa'
# ──────────────────────────────────────────────────────────────────────────────
# Plugins (using TPM - Tmux Plugin Manager)
# ──────────────────────────────────────────────────────────────────────────────
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# ──────────────────────────────────────────────────────────────────────────────
# Plugin Configuration
# ──────────────────────────────────────────────────────────────────────────────
# tmux-resurrect settings
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'ssh psql mysql sqlite3 "~yarn dev" "~npm start" "~rails server"'
# tmux-continuum settings
set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
# Continuum status styling
set -g @continuum-status-on-wrap-style '#[fg=#a6e3a1 bold]#{value}m#[default]'
set -g @continuum-status-off-wrap-style '#[fg=#f38ba8 bold]#{value}#[default]'
# tmux-yank settings (clipboard integration)
set -g @yank_selection 'primary'
set -g @yank_selection_mouse 'clipboard'
# ──────────────────────────────────────────────────────────────────────────────
# Additional Tweaks
# ──────────────────────────────────────────────────────────────────────────────
# Allow renaming windows
set -g allow-rename on
# Display messages for longer
set -g display-time 2000
# Don't exit copy mode on mouse selection
set -g @yank_action 'copy-pipe-no-clear'
# Bell settings
set -g bell-action none
set -g visual-bell off
# ──────────────────────────────────────────────────────────────────────────────
# Conditional Configuration (host-specific)
# ──────────────────────────────────────────────────────────────────────────────
# Example: Different colors per machine
# %if #{==:#{host_short},laptop}
# set -g status-style 'bg=#1e3a5f,fg=#cdd6f4'
# %elif #{==:#{host_short},workstation}
# set -g status-style 'bg=#2d3a1f,fg=#cdd6f4'
# %endif
# ──────────────────────────────────────────────────────────────────────────────
# Initialize TPM (keep at bottom of .tmux.conf)
# ──────────────────────────────────────────────────────────────────────────────
# Install TPM if not already installed
run-shell 'if [ ! -d ~/.tmux/plugins/tpm ]; then git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm; fi'
# Initialize TPM
run '~/.tmux/plugins/tpm/tpm'
# ══════════════════════════════════════════════════════════════════════════════
# Quick Reference
# ══════════════════════════════════════════════════════════════════════════════
#
# Navigation:
# Alt + Arrows - Switch panes (no prefix needed!)
# Shift + Left/Right - Switch windows
# Ctrl+Shift + L/R - Reorder windows
# Prefix + Arrows - Resize panes
# Prefix + Tab - Last pane
#
# Windows & Panes:
# Prefix + c - New window (same directory)
# Prefix + | - Split vertical (same directory)
# Prefix + - - Split horizontal (same directory)
# Prefix + x - Kill pane
# Prefix + & - Kill window
#
# Copy Mode:
# Prefix + [ - Enter copy mode
# Prefix + Escape - Enter copy mode
# v - Begin selection (in copy mode)
# y - Copy selection (in copy mode)
# Prefix + ] - Paste
#
# Session Management:
# Prefix + d - Detach
# Prefix + s - List sessions
# Prefix + $ - Rename session
# Prefix + (/) - Previous/Next session
#
# Plugins:
# Prefix + I - Install plugins
# Prefix + U - Update plugins
# Prefix + Alt + u - Uninstall plugins
#
# Session Persistence:
# Prefix + Ctrl + s - Save session
# Prefix + Ctrl + r - Restore session
# (Auto-saves every 15 minutes when continuum is active)
#
# Misc:
# Prefix + r - Reload config
# Prefix + ? - List all keybindings
# Prefix + : - Command prompt
#
# ══════════════════════════════════════════════════════════════════════════════