-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
296 lines (218 loc) · 9.3 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
######################
### HOTKEY CHANGES ###
######################
# Fuzzy session finder
# https://thoughtbot.com/blog/a-tmux-crash-course
# https://github.com/junegunn/dotfiles/blob/master/tmux.conf
# https://thoughtbot.com/upcase/videos/tmux-advanced-workflow
# https://coderwall.com/p/_g2vpq/workflow-in-tmux
# https://gist.github.com/Starefossen/5955406
# https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# https://github.com/git-pull/tao-of-tmux/blob/master/manuscript/09-status-bar.md
# https://github.com/rothgar/awesome-tmux
# https://github.com/gpakosz/.tmux
# https://github.com/tmux-python/tmuxp/
# TODO: Use a slightly different zsh-config when running in tmux?
# TODO: Setup proper clipboard workflow that works across SSH as well
# Both iterm2 & tmux support OSC52: https://github.com/tmux/tmux/wiki/Clipboard
# https://blog.landofcrispy.com/index.php/2021/01/06/clipboard-integration-between-tmux-nvim-zsh-x11-across-ssh-sessions/
# https://github.com/theimpostor/osc52
set-option -g default-shell /spare/local/szafar/apps/zsh/bin/zsh
# Remap prefix from 'C-b' to 'C-f' because f is more easily reachable
unbind C-b
set-option -g prefix C-f
bind-key C-f send-prefix
# iterm2 uses Ctrl+f for Find
# set-option -g prefix C-a
# bind-key C-a send-prefix
# split panes using | and -
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# resize 48 columns to the right; nice for 27" display 70/30-ish split.
bind-key + resize-pane -R 30
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Set window name to the current directory name.
# bind C-p run -b "tmux rename-window $(basename #{pane_current_path})"
# switch panes using Alt-arrow without prefix
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
bind -n s-left previous-window
bind -n s-right next-window
bind -n M-s-left swap-window -d -t -1
bind -n M-s-right swap-window -d -t +1
# Normally next-layout, which is a pathological custom-layout murderer.
unbind-key Space
# Instead, toggle "zoom pane", which full-screens the current pane.
bind Space resize-pane -Z # with prefix
bind -n C-Space resize-pane -Z # without prefix
bind -n M-Space resize-pane -Z # without prefix
# Vim style
# bind-key -t vi-copy y copy-pipe "xclip -i -sel clip"
# bind-key p run "xclip -o -sel clip | tmux load-buffer -"
# bind -n C-k clear-history
unbind -n C-k
bind C-m set-option -g mouse
# Sync
bind C-y set-window-option synchronize-panes on \; display-message "Panes synchronized."
bind C-h set-window-option synchronize-panes off \; display-message "Panes un-synchronized."
# https://superuser.com/questions/196060/selecting-text-in-tmux-copy-mode
# Use v to trigger selection
bind-key -T copy-mode-vi v send-keys -X begin-selection
# An easier way to rename windows
bind-key -n M-F2 command-prompt -I "#W" "rename-window -- '%%'"
bind-key -n C-F2 command-prompt -I "#S" "rename-session -- '%%'"
# Because I bind 'f' with fingers, but find-window seems useful too!
bind-key -T prefix F command-prompt "find-window '%%'"
bind-key -T prefix s choose-tree -s
# choose sessions and windows with "f", choose only windows with "w"
# dirty trick for fullscreen interactive command
# split window first, and then fullscreen it with resize
bind -n C-s display-popup -w 100 -h 30 -E "~/.scripts/ftpane"
bind w display-popup -w 100 -h 30 -E "~/.scripts/ftwin "
# Session switching
bind-key -n C-Delete switch-client -l
bind-key -n C-Up switch-client -p
bind-key -n C-Down switch-client -n
bind-key -n S-Up switch-client -p
bind-key -n S-Down switch-client -n
bind-key -n C-\\ copy-mode
######################
### CONFIG CHANGES ###
######################
set -g mode-keys vi
set -g history-limit 50000
set -g history-file ~/.tmux_history
set -g set-titles on
set -g set-titles-string "#T"
set -g default-terminal "screen-256color"
# set -g default-terminal "xterm-256color"
# Time tmux waits while intercepting escape key.
set -sg escape-time 0
# Time tmux waits for repeated commands.
# e.g. "C-a right right" to switch across two panes.
# This only ever gets in the way for me.
set -g repeat-time 0
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity on
# set-option -g bell-action none
# Use Ctrl+left/right for word movement
# https://superuser.com/a/395273
set-window-option -g xterm-keys on
# set -g pane-border-status top
# setw pane-border-status top
# set -g pane-border-format "#P: #{pane_current_command}"
# toggle pane title visibility
# bind T run 'zsh -c "arr=( off top ) && tmux setw pane-border-status \${arr[\$(( \${arr[(I)#{pane-border-status}]} % 2 + 1 ))]}"'
# rename pane
# bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
# https://github.com/tmux/tmux/issues/1419
set -as terminal-overrides ',*:indn@'
######################
### DESIGN CHANGES ###
######################
# panes
# set -g pane-border-style fg=black
# set -g pane-active-border-style fg=brightred
## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2
# messaging
set -g message-style fg=black,bg=yellow
set -g message-command-style fg=blue,bg=black
#window mode
set -g mode-style fg=colour0,bg=colour6
# The modes
set -g clock-mode-colour colour135
set -g mode-style fg=colour196,bg=colour238,bold
# The panes
set -g pane-border-style fg=colour238,bg=colour235
set -g pane-active-border-style fg=colour51,bg=colour236
# The statusbar
set -g status-justify centre
set -g status-position bottom
set -g status-style bg=colour234,fg=colour137
set -g status-left '#S #I:#P #{prefix_highlight}'
set -g status-right '%l:%M %p '
set -g status-right-length 20
set -g status-left-length 20
set -g window-status-current-style fg=colour81,bg=colour238,bold
set -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W:#[fg=colour50]#F '
# set -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W:#{pane_current_path}#[fg=colour50]#F '
set -g window-status-style fg=colour138,bg=colour235
set -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W:#[fg=colour244]#F '
set-option -g status-interval 1
# set -g window-status-bell-style fg=colour255,bg=colour1,bold
# The messages
set -g message-style fg=colour232,bg=colour166,bold
# # ----------------------
# # Status Bar
# # -----------------------
# #show host name and IP address on left side of status bar
# set -g status-left-length 70
# set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
# Show session name, window & pane number, date and time on right side of status bar
# set -g status-right-length 60
# set -g status-right "#[fg=blue]#S #I:#P #[fg=yellow]:: %d %b %Y #[fg=green]:: %l:%M %p :: #(date -u | awk '{print $4}')::"
# set -g status-right "#[fg=green] %l:%M %p "
# https://github.com/tmux-plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# https://github.com/tmux-plugins/tmux-resurrect
set -g @resurrect-processes 'ssh'
set -g @resurrect-capture-pane-contents 'on'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-save-interval '30'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Tmux Logging - to write output of panes to files
# https://github.com/tmux-plugins/tmux-logging
set -g @logging-path "~/.tmux/logs"
set -g @plugin 'tmux-plugins/tmux-logging'
# https://github.com/tmux-plugins/tmux-sessionist
set -g @plugin 'tmux-plugins/tmux-sessionist'
# https://github.com/tmux-plugins/tmux-copycat
set -g @copycat_search_C-e 'error.*'
set -g @plugin 'tmux-plugins/tmux-copycat'
# https://github.com/tmux-plugins/tmux-yank
set -g @plugin 'tmux-plugins/tmux-yank'
# https://github.com/tmux-plugins/tmux-open
# set -g @plugin 'tmux-plugins/tmux-open'
# https://github.com/NHDaly/tmux-better-mouse-mode
# set -g @plugin 'nhdaly/tmux-better-mouse-mode'
# https://github.com/laktak/extrakto
set -g @extrakto_insert_key enter
set -g @extrakto_copy_key tab
set -g @extrakto_key none
set -g @extrakto_popup_size '70%'
set -g @extrakto_grab_area 'full'
set -g @plugin 'laktak/extrakto'
bind-key -n F1 run-shell "\"~/.tmux/plugins/extrakto/scripts/open.sh\" \"#{pane_id}\""
# https://github.com/wfxr/tmux-fzf-url
# set -g @plugin 'wfxr/tmux-fzf-url'
# https://github.com/jaclu/tmux-menus
set -g @menus_trigger 'F9'
set -g @menus_without_prefix 1
set -g @plugin 'jaclu/tmux-menus'
# https://github.com/roosta/tmux-fuzzback
# set -g @plugin 'roosta/tmux-fuzzback'
# https://github.com/sainnhe/tmux-fzf
set -g @plugin 'sainnhe/tmux-fzf'
# https://github.com/tmux-plugins/tmux-prefix-highlight
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# https://github.com/jhonrocha/tmux-copy-output
# set -g @plugin 'jhonrocha/tmux-copy-output'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'