-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
tmux.conf
274 lines (245 loc) · 10.6 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
# .tmux.conf
#
# Maintained by Byungjin Park <posquit0.bj@gmail.com>
# https://www.posquit0.com/
### General {{{
# Use UTF-8 encoding
set-option -gq utf8
set-window-option -gq utf8 on
# set-option scrollback history to 10000 (10k)
set-option -g history-limit 10000
# 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'
### }}}
### 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
tmux_version="`tmux -V | cut -d' ' -f2`"
if-shell "[ $tmux_version -ge 2.4 ]" \
"bind-key -T copy-mode-vi 'v' send -X begin-selection"
if-shell "[ $tmux_version -lt 2.4 ]" \
'bind-key -t vi-copy v begin-selection'
if-shell "[ $tmux_version -ge 2.4 ]" \
"bind-key -T copy-mode-vi 'y' send -X copy-selection"
if-shell "[ $tmux_version -lt 2.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 on
# 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 '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
## 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: 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'
### }}}