-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
286 lines (219 loc) · 7.28 KB
/
tmux.conf
File metadata and controls
286 lines (219 loc) · 7.28 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
# Tmux Configuration
# Based on best practices for development workflows
# ===========================
# General Settings
# ===========================
# Set default shell to zsh
set-option -g default-shell /opt/homebrew/bin/zsh
set-option -g default-command /opt/homebrew/bin/zsh
# Set prefix to Ctrl-a (easier to reach than Ctrl-b)
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Enable 256 colors (simplified for compatibility)
set -g default-terminal "screen-256color"
# Set scrollback buffer size
set -g history-limit 50000
# Enable mouse support
set -g mouse on
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when one is closed
set -g renumber-windows on
# Set escape time (for vim)
set -sg escape-time 0
# Enable vi mode
setw -g mode-keys vi
# Status bar update interval
set -g status-interval 5
# Enable focus events
set -g focus-events on
# Aggressive resize
setw -g aggressive-resize on
# Set terminal title
set -g set-titles on
set -g set-titles-string '#H:#S.#I.#P #W #T'
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity off
# ===========================
# Key Bindings
# ===========================
# Reload configuration
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"
# Split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Navigate panes with vim-like keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes with vim-like keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Quick pane cycling
bind -r Tab select-pane -t :.+
# Window navigation
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Move windows left/right
bind -r < swap-window -t -1 \; select-window -t -1
bind -r > swap-window -t +1 \; select-window -t +1
# Synchronize panes
bind S setw synchronize-panes
# Copy mode bindings (vi-style)
bind Enter copy-mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind -T copy-mode-vi r send-keys -X rectangle-toggle
# Paste buffer
bind p paste-buffer
bind P choose-buffer
# Clear history
bind -n C-k clear-history
# Layout shortcuts
bind M-1 select-layout main-horizontal
bind M-2 select-layout main-vertical
bind M-3 select-layout even-horizontal
bind M-4 select-layout even-vertical
bind M-5 select-layout tiled
# Toggle pane zoom
bind z resize-pane -Z
# Break pane into window
bind b break-pane -d
# Join pane from window
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# ===========================
# Status Bar
# ===========================
# Status bar position
set -g status-position bottom
# Status bar colors (simple, compatible colors)
set -g status-bg black
set -g status-fg white
# Status left
set -g status-left-length 50
set -g status-left ' #S | #I:#P '
# Status right
set -g status-right-length 100
set -g status-right ' %a %Y-%m-%d | %H:%M:%S | #(whoami)@#H '
# Window status (simple format)
setw -g window-status-format ' #I:#W '
setw -g window-status-current-format '[#I:#W]'
# Message style
set -g message-style 'fg=white,bg=black,bold'
# Pane borders
set -g pane-border-style 'fg=white'
set -g pane-active-border-style 'fg=green'
# Display panes
set -g display-panes-active-colour green
set -g display-panes-colour white
# ===========================
# Copy Mode and Clipboard
# ===========================
# macOS clipboard integration
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
# Enter copy mode with Prefix + [
bind [ copy-mode
# Search in copy mode
bind / copy-mode \; send-keys ?
# Quick scrolling
bind -T copy-mode-vi C-u send-keys -X halfpage-up
bind -T copy-mode-vi C-d send-keys -X halfpage-down
# Select entire line
bind -T copy-mode-vi V send-keys -X select-line
# Copy current command line
bind Y run-shell "tmux show-buffer | pbcopy" \; display-message "Copied to clipboard"
# ===========================
# Smart Pane Navigation
# ===========================
# Smart pane switching with awareness of Vim splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# ===========================
# Performance Optimization
# ===========================
# Reduce escape time
set -s escape-time 0
# Increase repeat time
set -g repeat-time 600
# Reduce display time
set -g display-time 2000
set -g display-panes-time 2000
# Optimize for fast terminals
set -g assume-paste-time 0
# Don't exit copy mode on mouse release
unbind -T copy-mode-vi MouseDragEnd1Pane
# Limit buffer size
set -g buffer-limit 20
# Set update environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# ===========================
# Nested Sessions Support
# ===========================
# Toggle on/off all keybindings (for nested tmux)
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=colour245,bg=colour238" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
refresh-client -S
# ===========================
# Plugins (TPM)
# ===========================
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'christoomey/vim-tmux-navigator'
# Additional plugins
set -g @plugin 'akohlbecker/aw-watcher-tmux'
set -g @plugin 'bjesus/muxile'
set -g @plugin 'b0o/tmux-autoreload'
set -g @plugin 'ofirgall/tmux-browser'
set -g @plugin 'vascomfnunes/tmux-cargo'
set -g @plugin 'tmux-plugins/tmux-cowboy'
set -g @plugin 'tmux-plugins/tmux-fpp'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'danyim/tmux-git-autofetch'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'jaclu/tmux-menus'
set -g @plugin 'noscript/tmux-mighty-scroll'
set -g @plugin 'koiosdev/tmux-neolazygit'
set -g @plugin 'joshmedeski/tmux-nerd-font-window-name'
set -g @plugin 'rickstaa/tmux-notify'
set -g @plugin 'erikw/tmux-powerline'
# Plugin configurations
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-save-interval '15'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'