forked from lbesnard/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
321 lines (243 loc) · 10.4 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
314
315
316
317
318
319
320
321
# cat << ►_◄ > /dev/null
# (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz)
# -- general -------------------------------------------------------------------
# if run as "tmux attach", create a session if one does not already exist
new-session -n $HOST
set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 0 # fastest command sequences
set -sg repeat-time 400 # increase repeat timeout
set -s quiet on # disable various messages
#set -g prefix2 C-a # GNU-Screen compatible prefix
set -g prefix C-a # GNU-Screen compatible prefix
#bind C-a send-prefix -2
bind-key -n C-b send-prefix #https://simplyian.com/2014/03/29/using-tmux-remotely-within-a-local-tmux-session/#
set -g history-limit 5000 # boost history
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
if 'which -s reattach-to-user-namespace' 'set -g default-command "exec initializing... 2> /dev/null & reattach-to-user-namespace $SHELL -l"'
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
# renumber windows when a window is closed
set -g renumber-windows on
set -g set-titles on # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set-window-option -g aggressive-resize on # force pane size when tmux inside tmux (ssh for example)
#set -g aggressive-resize on
set -g status-interval 10 # redraw status line every 10 seconds
# 24 hour clock
setw -g clock-mode-style 24
# clear both screen and history
bind -n C-l send-keys C-l \; run 'tmux clear-history'
# activity
set -g monitor-activity on
set -g visual-activity off
# -- navigation ----------------------------------------------------------------
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane'
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# toggle mouse
bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"
# -- urlview -------------------------------------------------------------------
bind U run "cut -c3- ~/.tmux.conf | sh -s urlview #{pane_id}"
# -- facebook pathpicker -------------------------------------------------------
bind F run "cut -c3- ~/.tmux.conf | sh -s fpp #{pane_id}"
# -- list choice ---------------------------------------------------------------
bind -t vi-choice h tree-collapse
bind -t vi-choice l tree-expand
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null'
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null'
bind -t vi-choice H tree-collapse-all
bind -t vi-choice L tree-expand-all
bind -t vi-choice Escape cancel
# -- edit mode -----------------------------------------------------------------
# the following vi-copy bindings match my vim settings
# see https://github.com/gpakosz/.vim.git
bind -ct vi-edit H start-of-line
bind -ct vi-edit L end-of-line
bind -ct vi-edit q cancel
bind -ct vi-edit Escape cancel
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
bind b list-buffers # list paster buffers
bind p paste-buffer # paste from the top pate buffer
bind P choose-buffer # choose which buffer to paste from
# the following vi-copy bindings match my vim settings
# see https://github.com/gpakosz/.vim.git
bind -t vi-copy v begin-selection
bind -t vi-copy C-v rectangle-toggle
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel
bind -t vi-copy H start-of-line
bind -t vi-copy L end-of-line
# copy to Mac OSX pasteboard
if -b 'which -s reattach-to-user-namespace' 'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# -- user defined --------------------------------------------------------------
#if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
# -- 8< ------------------------------------------------------------------------
run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# -- user defined --------------------------------------------------------------
# (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz)
# use the powerline patched font variant of the theme, possible values are:
# - default
# - powerline
#tmux_conf_theme=default
tmux_conf_theme=powerline
# display an indicator in the status line when the prefix key has been pressed,
# possible values are:
# - enabled
# - disabled
tmux_conf_theme_prefix=disabled
#tmux_conf_theme_prefix=enabled
# display the battery information in the status line, possible values are:
# - enabled
# - disabled
tmux_conf_theme_battery=enabled
#tmux_conf_theme_battery=disabled
# style to use for the battery status, possible values are:
# - bar
# - percentage
tmux_conf_battery_style=bar
#tmux_conf_battery_style=percentage
# symbols to use for battery status, possible values are:
# - block
# - heart
tmux_conf_battery_symbol=block
#tmux_conf_battery_symbol=heart
# number of symbols to use for battery status
tmux_conf_battery_symbol_count=auto
#tmux_conf_battery_symbol_count=5
# palette used for the battery status, possible values are:
# - 'colour_full_fg,colour_empty_fg,colour_bg'
# - heat
# - gradient
tmux_conf_battery_palette='#d70000,#e4e4e4,#000000'
#tmux_conf_battery_palette=colour160,colour254,colour16
#tmux_conf_battery_palette=heat
#tmux_conf_battery_palette=gradient
# display the battery status: charging (U+26A1) / discharging (U+1F50B)
tmux_conf_battery_status=enabled
#tmux_conf_battery_status=disabled
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
#tmux_conf_battery='#(battery -t) '
# display the time in the status line, possible values are:
# - enabled
# - disabled
tmux_conf_theme_time=enabled
#tmux_conf_theme_time=disabled
# display the date in the status line, possible values are:
# - enabled
# - disabled
tmux_conf_theme_date=enabled
#tmux_conf_theme_date=disabled
# display the username in the status line, possible values are:
# - enabled
# - disabled
# - ssh
tmux_conf_theme_username=enabled
#tmux_conf_theme_username=disabled
#tmux_conf_theme_username=ssh
# display the hostname in the status line, possible values are:
# - enabled
# - disabled
# - ssh
tmux_conf_theme_hostname=enabled
#tmux_conf_theme_hostname=disabled
#tmux_conf_theme_hostname=ssh
# highlight focuse pane, possible values are:
# - enabled
# - disabled
tmux_conf_theme_highlight_focused_pane=disabled
#tmux_conf_theme_highlight_focused_pane=enabled
# should new windows retain current path, possible values are:
# - true
# - false
tmux_conf_new_windows_retain_current_path=false
#tmux_conf_new_windows_retain_current_path=true
# should new panes reatin current path, possible values are:
# - true
# - false
tmux_conf_new_panes_retain_current_path=true
#tmux_conf_new_panes_retain_current_path=false
# prompt for session name when creating a new session, possible values are:
# - true
# - false
#tmux_conf_new_session_prompt=false
tmux_conf_new_session_prompt=true
# if you're running tmux within iTerm2
# - and tmux is 1.9 or 1.9a
# - and iTerm2 is configured to let option key act as +Esc
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
# then uncomment the following line to make Meta + arrow keys mapping work
#set -g terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
# ------------------------------------------------------------------------------
# this is the place to further customize tmux's configuration
#set -g history-limit 10000
set-window-option -g mode-keys vi
# Splitting panes.
bind u split-window -h
bind _ split-window -h
bind - split-window -v
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
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 @continuum-restore 'on'
set -g @plugin 'christoomey/vim-tmux-navigator'
# highlight pane
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# Removes ESC delay
set -sg escape-time 0
# List of plugins
set -g @tpm_plugins ' \
caiogondim/maglev \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-battery \
tmux-plugins/tmux-cpu \
'
run '~/.tmux/plugins/tpm/tpm'
run '~/.tmux/plugins/tpm/bin/install_plugins'
# status line with CMUS
status_fg=colour253 # white
status_bg=colour0 # dark gray
session_fg=colour16 # black
session_bg=colour11 # yellow
set -g status-left-length 200
left_separator_black=''
status_left="#[fg=$session_fg,bg=$session_bg,bold] #S #[fg=$session_bg,bg=$status_bg,nobold]$left_separator_black #[fg=$session_fg,bg=$session_bg,bold]#(~/.cmus/cmus-tmux-statusbar.sh)"
set -g status-left "$status_left"
set-option -gw window-status-activity-style fg=red,bg=black,bold
# CMUS key bindings, M(eta) use Alt-1 Alt-2 ...
if-shell 'command -v cmus-remote' 'bind-key -n M-1 run-shell -b "cmus-remote -r"'
if-shell 'command -v cmus-remote' 'bind-key -n M-2 run-shell -b "cmus-remote -u"'
if-shell 'command -v cmus-remote' 'bind-key -n M-3 run-shell -b "cmus-remote -n"'