-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
313 lines (255 loc) · 9.97 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
# General Settings -------------------------------------------------------
set -g default-terminal "screen-256color"
set -g history-limit 20000
set -g buffer-limit 20
set -sg escape-time 0
set -g display-time 1500
set -g remain-on-exit off
set -g repeat-time 300
setw -g allow-rename off
setw -g automatic-rename off
setw -g aggressive-resize on
# Change prefix key to C-a, easier to type, same to "screen"
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
set -g set-titles-string "#I:#W"
# Start index of window/pane with 1, because we're humans, not computers
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse support
set -g mouse on
# Key Bindings -----------------------------------------------------------
# Unbind default key bindings, we're going to override
unbind "\$" # rename-session
unbind , # rename-window
unbind % # split-window -h
unbind '"' # split-window
unbind "}" # swap-pane -D
unbind "{" # swap-pane -U
unbind [ # paste-buffer
unbind ]
unbind "'" # select-window
unbind n # next-window
unbind p # previous-window
unbind l # last-window
unbind M-n # next window with alert
unbind M-p # next window with alert
unbind o # focus thru panes
unbind & # kill-window
unbind "#" # list-buffer
unbind = # choose-buffer
unbind z # zoom-pane
unbind r
unbind e
unbind M-Up # resize 5 rows up
unbind M-Down # resize 5 rows down
unbind M-Right # resize 5 rows right
unbind M-Left # resize 5 rows left
# Edit configuration and reload - FIXME
#bind-key e new-window -n 'tmux.conf' "sh -c '\${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"Config reloaded\"'"
# Reload tmux configuration
bind-key r source-file ~/.tmux.conf \; display "Config reloaded"
# Easy-to-remember split pane commands
bind '\' split-window -h -c '#{pane_current_path}' # vertical pane
bind - split-window -v -c '#{pane_current_path}' # horizontal pane
unbind '"'
unbind %
# Sync panes
unbind s
bind C-s setw synchronize-panes
# new window and retain cwd
bind c new-window -c "#{pane_current_path}"
# Prompt to rename window right after it's created
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
# Rename session and window
bind R command-prompt -I "#{window_name}" "rename-window '%%'"
# Select pane and windows
bind -r C-[ previous-window
bind -r C-] next-window
bind -r [ select-pane -t :.-
bind -r ] select-pane -t :.+
bind -r Tab last-window # cycle thru MRU tabs
bind -r C-o swap-pane -D
# Update ENV
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION SSH_TTY WINDOWID XAUTHORITY DISPLAY"
# Window monitoring ------------------------------------------------------
bind m setw monitor-activity \; display-message 'Monitor window activity [#{?monitor-activity,ON,OFF}]'
bind M if -F '#{monitor-silence}' \
'setw monitor-silence 0 ; display-message "Monitor window silence [OFF]"' \
'command-prompt -p "Monitor silence: interval (s)" "setw monitor-silence %%"'
# Activity bell and whistles
set -g visual-activity on
# Clipboard & Scroll support ---------------------------------------------
# Prefer vi style key table
setw -g mode-keys vi
bind p paste-buffer
bind C-p choose-buffer
# trigger copy mode by
bind -n M-Up copy-mode
# Scroll up/down by 1 line, half screen, whole screen
bind -T copy-mode-vi M-Up send-keys -X scroll-up
bind -T copy-mode-vi M-Down send-keys -X scroll-down
bind -T copy-mode-vi M-PageUp send-keys -X halfpage-up
bind -T copy-mode-vi M-PageDown send-keys -X halfpage-down
bind -T copy-mode-vi PageDown send-keys -X page-down
bind -T copy-mode-vi PageUp send-keys -X page-up
# When scrolling with mouse wheel, reduce number of scrolled rows per tick to "2" (default is 5)
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
set -g set-clipboard on
# Set history to something usable
set-option -g history-limit 20000
# Theme ------------------------------------------------------------------
# Colors -----------------------------------------------------------------
## Defaults
TC="#E25140"
## Urgency
LEVEL_OK="#00ff00"
LEVEL_WARN="#ffff31"
LEVEL_CRIT="#ff0000"
## Greys
W00="#ffffff"
G01="#080808"
G02="#121212"
G03="#1c1c1c"
G04="#262626"
G05="#303030"
G06="#3a3a3a"
G07="#444444"
G08="#4e4e4e"
G09="#585858"
G10="#94ADCB"
G11="#6c6c6c"
G12="#767676"
## Variables
FG="$G12"
BG="$G02"
FG_OFF="$G07"
## Icons -----------------------------------------------------------------
right_arrow_icon=""
left_arrow_icon=""
session_icon="舘"
prompt_icon="ﲵ"
user_icon=""
time_icon=""
date_icon="'"
online_icon="●"
cpu_icon=""
mem_icon=""
#keys_off_icon=""
## Options ---------------------------------------------------------------
time_format='%l:%M'
date_format='%m/%d'
### Status options
set -g status-interval 1
set -g status on
### Basic status bar colors
set -g status-fg "$FG"
set -g status-bg "$BG"
### Window separator
set -g window-status-separator ""
set -g status-justify centre
set -g status-position top
### Pane border
set -g pane-border-style "fg=$G04,bg=default"
### Active pane border
set -g pane-active-border-style "fg=$TC,bg=$BG"
### Active monitoring notification
set -g window-status-activity-style "fg=$TC"
### Pane number indicator
set -g display-panes-colour "$G04"
set -g display-panes-active-colour "$TC"
### Clock mode
set -g clock-mode-colour "$TC"
set -g clock-mode-style 24
### Message
set -g message-style "fg=$TC,bg=$BG"
### Command message
set -g message-command-style "fg=$TC,bg=$BG"
### Copy mode highlight
set -g mode-style "bg=$TC,fg=$W00"
# Status bar -------------------------------------------------------------
set -g status-left-length 150
set -g status-right-length 150
wg_session="#[fg=$W00,bg=$TC] $user_icon #U@#{hostname_short} #[fg=$TC,bg=$G06,nobold]$right_arrow_icon"
wg_session_icon="#[fg=$W00,bg=$G06] $session_icon #I #[fg=$G06,bg=$BG]$right_arrow_icon "
wg_time="#[fg=$G06,bg=$BG]$left_arrow_icon#[fg=$W00,bg=$G06] $time_icon $time_format "
wg_date="#[fg=$TC,bg=$G06]$left_arrow_icon#[fg=$W00,bg=$TC] $date_icon $date_format "
wg_cpu="#[fg=$G06,bg=$BG]$left_arrow_icon#[fg=$W00,bg=$G06] $cpu_icon #{sysstat_cpu}"
wg_mem="#[fg=$TC,bg=$G06]$left_arrow_icon#[fg=$W00,bg=$G06] $mem_icon #{sysstat_mem}"
wg_keys_off="#[fg=$TC,bg=$BG]#([ $(tmux show-option -qv key-table) = 'off' ] && echo '▽') #[default]"
set -g status-left "$wg_session $wg_session_icon #{online_status} #{prefix_highlight}"
set -g status-right "$wg_keys_off #{battery_icon} #{battery_color_charge_fg}#{battery_percentage} $wg_time $wg_date"
set -g window-status-format " #I:#W "
set -g window-status-current-format "#[fg=$TC,bg=$BG]$left_arrow_icon#[fg=$W00,bg=$TC,nobold]$prompt_icon #W #[fg=$TC,bg=$BG,nobold]$right_arrow_icon"
#set -g window-status-current-format "#[fg=$TC,bg=$BG]$left_arrow_icon#[fg=$W00,bold,bg=$BG] #W #[fg=$TC,bg=$BG,nobold]$right_arrow_icon"
# Plugins ----------------------------------------------------------------
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'soyuka/tmux-current-pane-hostname'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'samoshkin/tmux-plugin-sysstat'
set -g @plugin 'jaclu/tmux-menus'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'jaclu/tmux-power-zoom'
# Plugin Options ---------------------------------------------------------
# Sidebar options
set -g @sidebar-tree 't'
set -g @sidebar-tree-command 'tree -x -L 2'
set -g @sidebar-tree-position 'right'
# Online options
set -g @online_icon "#[fg=$LEVEL_OK]●#[default]"
set -g @offline_icon "#[fg=$LEVEL_CRIT]●#[default]"
# Battery options
set -g @batt_color_charge_primary_tier8 "fg=$G06,bg=$BG"
set -g @batt_color_charge_primary_tier7 "fg=$G06,bg=$BG"
set -g @batt_color_charge_primary_tier6 "fg=$G06,bg=$BG"
set -g @batt_color_charge_primary_tier5 "fg=$G06,bg=$BG"
set -g @batt_icon_status_charging ""
set -g @batt_icon_status_discharging ""
set -g @batt_icon_status_unknown ""
set -g @batt_icon_status_attached ""
# Prefix Highlight options
set -g @prefix_highlight_output_prefix '<'
set -g @prefix_highlight_output_suffix '>'
set -g @prefix_highlight_fg "$TC"
set -g @prefix_highlight_bg "$BG"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr "fg=$TC,bold,bg=$BG"
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr "fg=$TC,bold,bg=$BG"
# Tmux Menu
set -g @menus_trigger '/'
set -g @menus_location_x 'C'
set -g @menus_location_y 'C'
# Power zoom
set -g @power_zoom_trigger 'z'
# Nesting Local & Remote sessions ----------------------------------------
# Session is considered to be remote when we ssh into host
if-shell 'test -n "$SSH_CLIENT"' \
'source-file ~/.tmux/tmux.remote.conf'
# Also, change some visual styles when window keys are off
#bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=$FG_OFF,bg=$BG" \;\
# set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
# set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
# if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
#bind -n off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
# set -u window-status-current-style \;\
# set -u window-status-current-format \;\
refresh-client -S
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'