-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtmux.conf
More file actions
352 lines (316 loc) · 14.2 KB
/
tmux.conf
File metadata and controls
352 lines (316 loc) · 14.2 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
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# .tmux.conf
#
# Maintained by Byungjin Park <posquit0.bj@gmail.com>
# https://www.posquit0.com/
# Grab version info about the tmux currently running
run-shell "tmux setenv -g TMUX_VERSION_MAJOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f1 | sed 's/[^0-9]*//g')"
run-shell "tmux setenv -g TMUX_VERSION_MINOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f2 | sed 's/[^0-9]*//g')"
### General {{{
# Use UTF-8 encoding
set-option -gq utf8
set-window-option -gq utf8 on
# set-option scrollback history to 50000 (50k)
set-option -g history-limit 50000
# Visual notification of activity in other windows
set-window-option -g monitor-activity on
set-option -g visual-activity on
# No automatic renaming of windows (from commands on execution)
set-window-option -g automatic-rename on
# set-option title, which is also showed at iTerm tab
# #T = standard window title (last command, see ~/.bash_profile)
# #h = short hostname
# #S = session name
# #I = tmux window index
# #W = tmux window name
# Attempt to set the window title using xterm code if tmux detects using xterm
set-option -g set-titles on
set-option -g set-titles-string "#I:#W"
# Fix `pbcopy` and `pbpaste` bug on Mac OS X
# INFO: Need to install `reattach-to-user-namespace`
# if-shell "which reattach-to-user-namespace 2>/dev/null" \
# "set-option -g default-command 'reattach-to-user-namespace -l $SHELL'" \
# "set-option -g default-command '$SHELL'"
# set-option -g default-command '$SHELL'
# set-option the terminal color to 256color
# set-option -g default-terminal "screen-256color"
set-option -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ',xterm-256color:Tc'
set-option -as terminal-overrides ',xterm*:sitm=\E[3m'
if-shell \
'[ $TMUX_VERSION_MAJOR -ge 4 -o \
\( $TMUX_VERSION_MAJOR -eq 3 -a $TMUX_VERSION_MINOR -ge 2 \) ]' \
'set -g allow-passthrough on'
### }}}
### Key Bindings {{{
# Key combination prefix is <C-a>, not <C-b>
set-option -g prefix C-a
unbind-key C-b
# Use send-prefix to pass C-a through to application
bind C-a send-prefix
# Reload ~/.tmux.conf using PREFIX r
bind r source-file ~/.tmux.conf \; display "TMUX configuration is reloaded!"
# Reduce the command delay time to something a bit shorter
set-option -sg escape-time 0
# Disallow multiple commands to be entered without pressing the prefix-key again
set-option -sg repeat-time 0
# Use vi-style key bindings in copy and choice modes
set-window-option -g mode-keys vi
# Use vi-style key bindings in the status line (command mode)
set-option -g status-keys vi
# Setup 'v' to begin selection as in Vim
if-shell \
'[ $TMUX_VERSION_MAJOR -ge 3 -o \
\( $TMUX_VERSION_MAJOR -eq 2 -a $TMUX_VERSION_MINOR -ge 4 \) ]' \
"bind-key -T copy-mode-vi 'v' send -X begin-selection"
if-shell \
'[ $TMUX_VERSION_MAJOR -le 1 -o \
\( $TMUX_VERSION_MAJOR -eq 2 -a $TMUX_VERSION_MINOR -lt 4 \) ]' \
'bind-key -t vi-copy v begin-selection'
if-shell \
'[ $TMUX_VERSION_MAJOR -ge 3 -o \
\( $TMUX_VERSION_MAJOR -eq 2 -a $TMUX_VERSION_MINOR -ge 4 \) ]' \
"bind-key -T copy-mode-vi 'y' send -X copy-selection"
if-shell \
'[ $TMUX_VERSION_MAJOR -le 1 -o \
\( $TMUX_VERSION_MAJOR -eq 2 -a $TMUX_VERSION_MINOR -lt 4 \) ]' \
'bind-key -t vi-copy y copy-selection'
bind P paste-buffer
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
# bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
# bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
# bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
# bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Map Vi movement keys as pane movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes using PREFIX H, J, K, L
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# Open window with currrent path
bind c new-window -c '#{pane_current_path}'
# Use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
# Make the current window the first window
bind T swap-window -t 1
# If enabled, request mouse input as UTF-8 on UTF-8 terminals
set-option -gq mouse-utf8 on
# If enabled, use mouse control in TMUX
set-window-option -g mouse on
### }}}
### Appereance {{{
# Let window numbers be 1-indexed
set-option -g base-index 1
# Automatically renumber window numbers on closing a pane (tmux >= 1.7)
set-option -g renumber-windows on
# Enable focus events for terminal that support them
set-option -g focus-events on
# set-option window notifications
set-window-option -g monitor-activity on
# Display a status line message when activity occurs in a window
set-option -g visual-activity off
# Display tmux messages for 2 seconds
set-option -g display-time 2000
# Enable aggressive-resize that is super useful when using grouped sessions and multi-monitor
set-window-option -g aggressive-resize on
## Window {{
set-window-option -g mode-style fg=colour254,bg=colour4,bold
# Clock Mode {{
# Set the clock colors
set-window-option -g clock-mode-colour colour160
# Set clock hour format
set-window-option -g clock-mode-style 24
# }}
# Display Panes {{
# Set the indicator colors for the active pane
set-option -g display-panes-active-colour colour4
# Set the indicator colors for the inactive pane
set-option -g display-panes-colour colour245
# }}
## }}
## Pane {{
# Let pane numbers be 1-indexed
set-option -g pane-base-index 1
# Set border colors for the inactive pane
set-option -g pane-border-style fg=colour235,bg=default
# Set border colors for the active pane
set-option -g pane-active-border-style fg=colour59,bg=default
## }}
## Status Line {{
# Turn the status line on
set-option -g status on
# Treat top-bit-set characters in the status-left and status-right as UTF-8
set-option -gq status-utf8 on
# Update status every 5 seconds
set-option -g status-interval 5
# Set colors and attributes for the status line
set-option -g status-style fg=colour15,bg=default,none
# Window List {{
## Window List
# Center window list for clarity
set-option -g status-justify centre
# Configure contents in window status
set-window-option -g window-status-format "[#I/#{pane_current_command}]"
# Set colors and attributes for the window status text
set-window-option -g window-status-style fg=colour244,bg=default,dim
# Configure contents in current window status
set-window-option -g window-status-current-format "#I/#{pane_current_command}"
# Set colors and attributes for the current window status text
set-window-option -g window-status-current-style fg=colour254,bg=default,bold
# Set colors and attributes for the status text of window which have an activity
set-window-option -g window-status-activity-style fg=colour64,bg=default,bold
# }
# Left {{
# Configure elemnts to show on left side of the status line
# set-option -g status-left-length 70
# set-option -g status-left "#[fg=colour1] #H"
# set-option -ga status-left "#[fg=colour243,bold] » #[default]"
# set-option -ga status-left "#[fg=colour35]#(whoami)"
# set-option -ga status-left "#[fg=colour243,bold] » #[default]"
# set-option -ga status-left "#[fg=colour38]#S"
# set-option -ga status-left "#[fg=colour243,bold] » #[default]"
# set-option -ga status-left "#[fg=colour249]#I:#P"
# set-option -ga status-left "#[fg=colour243,bold] » #[default]"
# set-option -g status-left-fg colour243
# set-option -g status-left-style bg=default,none
# }
# Right {{
# Configure elemnts to show on right side of the status line
# set-option -g status-right-length 48
# set-option -g status-right "#[fg=colour243,bold] « #[default]"
# set-option -ga status-right "#{prefix_highlight}"
# set-option -ga status-right "#[fg=white,bg=colour29,bold] #{d_day_icon} #{d_day_remain}(#{d_day_percentage}) #[default]"
# set-option -ga status-right "#[fg=white,bg=colour64,bold]#{cpu_percentage} #[default]"
# set-option -ga status-right "#[fg=colour233,bg=colour15] %Y-%m-%d %a %H:%M #[default]"
# set-option -g status-right-fg colour243
# set-option -g status-right-style bg=default,none
# }
# Message {{
# Set colors and attributes for status line messages
set-option -g message-style fg=white,bg=colour65,bright
# }
## }}
### }}}
### Plugins {{{
# List of plugins
# Supports `github_username/repo` or full URL
# Examples:
# github_username/plugin_name
# git@github.com/user/plugin
# git@bitbucket.cmo/user/plugin
set-option -g @plugin 'tmux-plugins/tpm'
set-option -g @plugin 'tmux-plugins/tmux-battery'
set-option -g @plugin 'tmux-plugins/tmux-cpu'
set-option -g @plugin 'tmux-plugins/tmux-copycat'
set-option -g @plugin 'tmux-plugins/tmux-open'
set-option -g @plugin 'tmux-plugins/tmux-resurrect'
set-option -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set-option -g @plugin 'jaclu/tmux-menus'
set-option -g @plugin '2kabhishek/tmux2k'
set-option -g @plugin 'navahas/tmux-grimoire'
set-option -g @plugin 'posquit0/tmux-d-day'
## Shortcuts of plugins
# TPM
# <prefix> + I: installs new plugins from GitHub or any other git repository
# <prefix> + U: updates plugins
# <prefix> + alt-u: remove/uninstall plugins not on the plugin list
# Copycat
# <prefix> + /: regex search
# <prefix> + ctrl-f : simple file search
# <prefix> + ctrl-g : jumping over git status files (used after `git status` command)
# <prefix> + alt-h: jumping over SHA-1 hashes (used after `git log` command)
# <prefix> + ctrl-u : url search (http, ftp and git urls)
# <prefix> + ctrl-d : number search (mnemonic d, as digit)
# <prefix> + alt-i : ip address search
# n, N: jumps to the next/previous match
# Enter: To copy a highlighted match (vi mode)
# ctrl-w / alt-w: To copy a highlighted match (emacs mode)
# <prefix> + ]: To paste (this is Tmux default paste)
# Open
# o: open a highlighted selection with the system default program (open for OS X)
# ctrl-o: open a highlighted selection with the $EDITOR
# Resurrect
# <prefix> + ctrl-s: save
# <prefix> + ctrl-r: restore
# Menus
# <prefix> + \: Display menus
## Plugin: Resurrect {{
# set-option directory to save TMUX environments
set-option -g @resurrect-dir '~/.tmux-resurrect'
# Enable saving and restoring tmux pane contents
set-option -g @resurrect-capture-pane-contents 'on'
# Configuration for advanced restoring
set-option -g @resurrect-processes ' \
vi vim nvim gvim emacs man less more tail \
top htop glances iotop iftop sudo \
ssh irssi weechat weechat-curses mutt \
python ipython git tig mysql sqlite3 psql \
'
## }}
## Plugin: Menus {{
# Use this in order to trigger menus without first hitting <prefix>
set-option -g @menus_without_prefix 'No'
# Disabling caching also disables the Custom Menus feature
set-option -g @menus_use_cache 'Yes'
# Some menu items will display tmux dialogs, where each have their own rather complex set of special key bindings - choose-buffer, choose-client, choose-tree and customize-mode
# This feature is not available when whiptail / dialog is used.
set-option -g @menus_use_hint_overlays 'Yes'
# Since those key-listings tend to be rather long they might not fit on screen, and thus be silently skipped. Enabling this will offer an extra option Key Hints on each menu featuring an alternative that will display such a dialog, and mentioning which item on that menu it is related to.
set-option -g @menus_show_key_hints 'Yes'
# Each menu will include an extra item Display Commands with the shortcut !
# This feature is not available when whiptail / dialog is used or caching is disabled.
set-option -g @menus_display_commands 'Yes'
## }}
## Plugin: 2K {{
set-option -g @tmux2k-theme 'onedark'
set-option -g @tmux2k-show-powerline true
set-option -g @tmux2k-icons-only false
# to set powerline symbols
set-option -g @tmux2k-left-sep
set-option -g @tmux2k-right-sep
set-option -g @tmux2k-window-list-left-sep
set-option -g @tmux2k-window-list-right-sep
# Sets the format for the window list
set-option -g @tmux2k-window-list-format '#I:#W'
# Enables compact mode for the window list
set-option -g @tmux2k-window-list-compact true
set-option -g @tmux2k-session-icon ""
## }}
## Plugin: Grimoire {{
# Key Bindings
set-option -g @grimoire-key "f"
set-option -g @ephemeral-grimoire-key "F"
set-option -g @grimoire-kill-key "C"
# Global appearance
set-option -g @grimoire-title ' '
set-option -g @grimoire-color '#6c6c65'
set-option -g @grimoire-width '80%'
set-option -g @grimoire-height '70%'
set-option -g @grimoire-position 'bottom-center'
# Custom shpells
bind-key -T prefix g run-shell "custom_shpell ephemeral lazygit 'lazygit'"
set-option -g @shpell-lazygit-color '#dcdccd'
set-option -g @shpell-lazygit-position 'center'
set-option -g @shpell-lazygit-width '80%'
set-option -g @shpell-lazygit-height '80%'
# bind-key -T prefix t run-shell "custom_shpell ephemeral system-monitor 'btop'"
# set-option -g @shpell-system-monitor-color ''
# set-option -g @shpell-system-monitor-position 'bottom-center'
# set-option -g @shpell-system-monitor-width '80%'
# set-option -g @shpell-system-monitor-height '80%'
## }}
## Plugin: D-Day {{
set-option -g @d_day_start_date '2018-01-01'
set-option -g @d_day_end_date '2019-02-22'
set-option -g @d_day_icon '✓'
## }}
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf
run '~/.tmux/plugins/tpm/tpm'
### }}}