-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
458 lines (381 loc) · 16.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
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#-------- Common Settings {{{
#------------------------------------------------------
# https://gist.github.com/1147532
# http://crunchbanglinux.org/forums/post/236199/
# https://gist.github.com/adinapoli/4723872
# change prefix key to Ctrl-a; like GNU Screen
#Starting by loading powerline stuff
#run "powerline-daemon -q"
source "$HOME/bin/powerline/bindings/tmux/powerline.conf"
unbind-key C-b
set-option -g prefix C-a
# goto last used window
bind-key C-a last-window
# Nested Tmux Session
# send to tmux session within another tmux session; like screen
bind-key a send-prefix
# fix delay time between tmux & vim
set-option -sg escape-time 0
# default shell
set-option -g default-command /bin/zsh
set-option -g default-shell /bin/zsh
# reload config
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# edit config
bind-key e new-window -n 'conf' '${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"'
bind-key '/' new-window 'man tmux'
# clear screen and scrollback history
bind-key -n C-k send-keys C-l \; run 'tmux clear-history'
#unbind-key C-l
#bind-key -n C-k 'tmux clear-history'
# set display timelimit
set-option -g display-panes-time 2000
set-option -g display-time 1000
# history size
set-option -g history-limit 10000
# enable shell hotkeys C-left/C-right
# http://sigizmund.com/tmux-and-c-leftc-right/
set-window-option -g xterm-keys on
# enable 256 color terminal
# http://blog.sanctum.geek.nz/256-colour-terminals/
set-option -g default-terminal "screen-256color"
#set-option -g default-terminal "xterm-256color"
#}}}
#-------- Keybinding (Vim Style) {{{
#------------------------------------------------------
# vim keys in command prompt
set-option -g status-keys vi
# unicode
set-window-option -g utf8 on
# select panes
bind-key k select-pane -U
bind-key h select-pane -L
bind-key j select-pane -D
bind-key l select-pane -R
# cycle windows/panes (no prefix)
bind-key -n M-k select-pane -t :.- # prev pane
bind-key -n M-j select-pane -t :.+ # next pane
bind-key -n M-h select-window -t :- # previous window
bind-key -n M-l select-window -t :+ # next window
# resize panes
bind-key -r J resize-pane -D 1
bind-key -r K resize-pane -U 1
bind-key -r H resize-pane -L 1
bind-key -r L resize-pane -R 1
# better pane split bindings with current path (tmux 1.9+)
bind-key \ split-window -h -c "#{pane_current_path}" # vertical split
bind-key - split-window -v -c "#{pane_current_path}" # horizontal split
# new window/pane with the current path (tmux 1.9+)
bind-key c new-window -c "#{pane_current_path}"
# kill window/pane without prompt
# http://unix.stackexchange.com/a/30283
bind-key & kill-window
bind-key x kill-pane
# sync panes; send what you are typing to other panes.
bind-key C-l set-window-option synchronize-panes
#}}}
#-------- Copy Mode (Vim Style) {{{
#------------------------------------------------------
# This section of hotkeys mainly work in copy mode and no where else
# vim keys in copy or choice mode
set-window-option -g mode-keys vi
# copying selection vim style
# http://jasonwryan.com/blog/2011/06/07/copy-and-paste-in-tmux/
# https://github.com/myfreeweb/dotfiles/blob/master/tmux.conf
bind-key Enter copy-mode # enter copy mode; default [
bind-key -t vi-copy Escape cancel # exit copy mode; or hit q
bind-key -t vi-copy v begin-selection # begin visual mode
bind-key -t vi-copy V select-line # visual line
bind-key -t vi-copy y copy-selection # yank
bind-key -t vi-copy r rectangle-toggle # visual block toggle
bind-key p paste-buffer # paste; default ]
bind-key P choose-buffer # choose which buffer to paste from
# read and write and delete paste buffer ( xsel method)
# https://wiki.archlinux.org/index.php/Tmux#ICCCM_Selection_Integration
# ctrl+shift+v
bind-key < command-prompt -p "copy to tmux (hit enter to confirm):" "run-shell 'tmux set-buffer -- \"$(xsel -o -b)\"'"
bind-key > command-prompt -p "copy to xsel (hit enter to confirm):" "run-shell 'tmux show-buffer | xsel -i -b'"
# bind-key + command-prompt "delete-buffer"
#}}}
#-------- Mouse {{{
#------------------------------------------------------
# mouse to highlight and copy; to paste use prefix + ]
# http://awhan.wordpress.com/2012/04/18/tmux-copy-paste-with-mouse/
# temporarily allow regular terminal copy mode while mouse mode is enable
# visual line: shift+mouse
# visual block: ctrl+shift+mouse <-- only works on some terminals
# visual block: ctrl+mouse <-- (while mouse mode is disable) only works on some terminals
# toggle mouse on/off
# http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
bind-key m \
set-option -g mouse \;\
display-message 'Mouse: ON'
bind-key M \
set-option -g mouse \;\
display-message 'Mouse: OFF'
# }}}
#-------- Window / Pane Settings {{{
#------------------------------------------------------
# start window/pane index on 1 instead of 0
set-option -g base-index 1
set-window-option -g pane-base-index 1
# pane divider color; non active pane
set-option -g pane-border-fg green
set-option -g pane-border-bg black
# pane divider color; active pane
# helps when you have more than two panes.
# version 1.8 makes it easy to see 2 panes now
set-option -g pane-active-border-fg red
set-option -g pane-active-border-bg black
# make the current window the first window
bind T swap-window -t 1
# swap windows/panes
bind-key -n M-Left swap-window -t -1
bind-key -n M-Right swap-window -t +1
# bind-key -n M-Up swap-pane -U
# bind-key -n M-Down swap-pane -D
# auto renumber windows sequentially
# https://github.com/thoughtbot/dotfiles/blob/master/tmux.conf
set-option -g renumber-windows on
# set auto rename of windows base on command
#set-window-option -g automatic-rename on
# note: ohmyzsh users commet out DISABLE_AUTO_TITLE=true from zshrc to disable autorename
# http://superuser.com/questions/306028/tmux-and-zsh-custom-prompt-bug-with-window-name
#}}}
#-------- Statusbar {{{
#All taken care with Powerline tmux status bar.. ;)
#------------------------------------------------------
#set-option -g status on
#set-option -g status-interval 2
#set-option -g status-utf8 on
#set-option -g status-justify "centre"
#set-option -g status-left-length 60
#set-option -g status-right-length 90
#set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]##[fg=colour255, bg=colour27] #I #W #[fg=colour27, bg=colour235]"
#}}}
#}}}
#-------- External Scripts {{{
#------------------------------------------------------
# Run command on idle; screensaver
#set-option -g lock-after-time 1200
#set-option -g lock-command "i3lock-wrapper"
#}}}
#-------- Layout {{{
#------------------------------------------------------
# http://amjith.blogspot.com/2011/08/scripting-tmux-layouts.html
# http://unix.stackexchange.com/a/17118
# -v = split horizontal
# -h = split veritical
#junk template
bind-key M-j new-window -n Ranger -c $HOME \; \
send-keys 'sourcer &>/dev/null; clear && ranger' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear && ranger' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear && ranger' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'sourcer &>/dev/null; clear && ranger' 'Enter' \; \
#Multi template
bind-key M-a new-window -n Work -c $HOME \; \
send-keys 'sourcer &>/dev/null; clear' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'sourcer &>/dev/null; clear' 'Enter' \; \
select-pane -t 2
# email
bind-key M-e new-window -n email -c $HOME \; \
send-keys 'mutt' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'tudu' 'Enter' \; \
select-pane -t 1
# torrent Old Torrent thingy.. still researching wether to remove it or use some functionalities
#bind-key M-t new-window -n torr -c $HOME \; \
#send-keys 'tsm-ncurse' 'Enter' \; \
#split-window -h -p 50 -t 1 \; \
#send-keys 'clear && flexget-list' 'Enter' \; \
#split-window -v -p 50 -t 1 \; \
#send-keys 'clear && figlet -c Movie Trailers && youtube-viewer -C -f -4 --results=6 -u UCi8e0iOVk1fEOogdfu4YgfA' 'Enter' \; \
#select-pane -t 2
#New Torrent Thingy
bind-key M-t new-window -n torr -c $HOME \; \
send-keys 'figlet -ktc Torrents Search \& Download | lolcat' 'Enter' \; \
split-window -v -p 80 -t 1 \; \
send-keys 'figlet -tc Pirates Bay Search | lolcat' 'Enter' \; \
split-window -v -p 20 -t 2 \; \
send-keys 'ncmatrix -s -b -u 10 -I eth0 -T red -R magenta' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'figlet -ktc Torrent Activity | lolcat' 'Enter' \; \
split-window -v -p 70 -t 4 \; \
send-keys 'transmission-daemon ; tsm-ncurse' 'Enter' \; \
split-window -v -p 70 -t 2 \; \
send-keys 'torrtux' 'Enter' \; \
# chat
bind-key M-c new-window -n chat -c $HOME \; \
send-keys 'weechat-curses' 'Enter' \; \
split-window -h -p 20 -t 1 \; \
send-keys 'tty-clock -c' 'Enter' \; \
split-window -v -p 80 -t 2 \; \
send-keys 'ncmatrix -s -b -u 10 -I eth0 -T red -R magenta' 'Enter' \; \
split-window -v -p 40 -t 3 \; \
send-keys 'pipes' 'Enter' \; \
select-pane -t 1
# Music Offline With Mpd
bind-key M-r new-window -n Music -c $HOME \; \
send-keys 'figlet Life is Music | lolcat' 'Enter' \; \
split-window -v -p 60 -t 1 \; \
send-keys 'mpd; ncmpcpp' 'Enter' \; \
split-window -h -p 35 -t 1 \; \
send-keys 'pacmixer' 'Enter' \; \
split-window -v -p 55 -t 1 \; \
send-keys 'ncmpcpp -s visualizer' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 'tty-clock -c ' 'Enter' \; \
split-window -v -p 38 -t 2 \; \
send-keys 'cava' 'Enter' \; \
select-pane -t 2
# Music With Mpd
bind-key M-m new-window -n Music -c $HOME \; \
send-keys 'ncmpcpp -s visualizer' 'Enter' \; \
split-window -v -p 55 -t 1 \; \
send-keys 'mpd; ncmpcpp' 'Enter' \; \
split-window -h -p 55 -t 1 \; \
send-keys 'pacmixer' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'ranger' 'Enter' \; \
split-window -v -p 25 -t 2 \; \
send-keys 'figlet Learn To Listen | lolcat ' 'Enter' \; \
split-window -h -p 35 -t 2 \; \
send-keys 'tty-clock -c' 'Enter' \; \
split-window -v -p 55 -t 6 \; \
send-keys 'cava' 'Enter' \; \
split-window -h -p 55 -t 7 \; \
send-keys 'pipes -p 1' 'Enter' \; \
split-window -h -p 55 -t 5 \; \
send-keys 'sourcer &>/dev/null; clear && ncmatrix -s -b -u 10 -I eth0 -T red -R magenta' 'Enter' \; \
select-pane -t 1
# # fap
# bind-key M-f new-window -n fap -c $HOME \; \
# send-keys 'ranger ~/Storage/.blackbox' 'Enter' \; \
# split-window -v -p 50 -t 1 \; \
# send-keys 'clear && figlet Search Skeet CMX | lolcat' 'Enter' \; \
# split-window -h -p 50 -t 1 \; \
# send-keys 'reddit_top -s pornvids' 'Enter' \; \
# split-window -h -p 50 -t 2 \; \
# send-keys 'clear && figlet Discover | lolcat' 'Enter' \; \
# select-pane -t 2
# stats
bind-key M-y new-window -n stats -c $HOME \; \
send-keys 'htop' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'clear && figlet Freespace | lolcat' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 't lsp | less' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'df' 'Enter' \; \
select-pane -t 2
# news
bind-key M-n new-window -n news -c $HOME \; \
send-keys 'newsbeuter' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'clear && figlet Freespace | lolcat' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 'hacker_top' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'reddit_top -s linux' 'Enter' \; \
select-pane -t 2
# Code
bind-key M-w new-window -n Code -c $HOME \; \
send-keys 'sourcer &>/dev/null; clear && figlet -t Game Of Codes | lolcat' 'Enter' \; \
split-window -v -p 25 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear && ranger ~/Projects/' 'Enter' \; \
split-window -h -p 20 -t 1 \; \
send-keys 'sourcer &>/dev/null; clear && ncmatrix -s -b -u 10 -I eth0 -T red -R magenta' 'Enter' \; \
split-window -v -p 50 -t 3 \; \
send-keys 'sourcer &>/dev/null; clear && tty-clock -c' 'Enter' \; \
split-window -h -p 33 -t 2 \; \
send-keys 'sourcer &>/dev/null; clear && figlet Command | lolcat' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'sourcer &>/dev/null; clear && mongo' 'Enter' \; \
select-pane -t 1
# video
bind-key M-v new-window -n video -c $HOME \; \
send-keys 'ranger ~/Videos/youtube_download' 'Enter' \; \
split-window -v -p 50 -t 1 \; \
send-keys 'clear && figlet youtube | lolcat' 'Enter' \; \
split-window -h -p 50 -t 1 \; \
send-keys 'clear && figlet rtmpdump | lolcat' 'Enter' \; \
split-window -h -p 50 -t 2 \; \
send-keys 'clear && figlet Freespace | lolcat' 'Enter' \; \
select-pane -t 2
#}}}
#-------- Zooming {{{
#------------------------------------------------------
# v1.8 comes with zooming already (prefix + z)
# this is for older version of tmux
# Zoom Script (by jipumarino)
# https://github.com/jipumarino/tmux-zoom
# if you use a different starting number in your window/pane
# then change the number 0 to match it
# $old_zoom_window.0 and $new_zoom_window.0
bind-key -r Z run-shell "~/.scripts/tmux-zoom.sh"
# Zoom Toggle Key ( modified by Gnomeye )
# https://github.com/gotbletu/shownotes/blob/master/tmux_maximize_pane.txt
# if you use a different starting number in your window/pane
# then change the number 0 to match it
bind-key } run-shell "if [[ $(tmux list-window) =~ tmux-zoom ]]; then tmux last-window; tmux swap-pane -s tmux-zoom.0; tmux kill-window -t tmux-zoom; else tmux new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read'; tmux swap-pane -s tmux-zoom.0; tmux select-window -t tmux-zoom;fi"
# http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/
# }}}
#-------- URL Launcher {{{
#------------------------------------------------------
# This section is for grabbing links on the current pane/window without the mouse
# and launching it with GUI or CLI browser
# w3m context view
# http://www.mail-archive.com/mutt-users@mutt.org/msg09657.html
# hit ':' to activate links; Tab or Esc+M to browse thru the links
# hit Esc then Shift+M to open GUI browser; make sure external browser is set in w3m config
# hit Q to quit without confirmation
#bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "w3m" '$SHELL -c "w3m < /tmp/tmux-buffer"'
# urlview
# https://wiki.archlinux.org/index.php/Tmux#Browsing_URL.27s
# to set default browser add to ~/.urlview; COMMAND exec >> /tmp/urlview.out 2>&1; set -x; $BROWSER
#bind-key O capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
# urlscan context view and url view
# compact view; show links only
#bind-key y capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan -c < /tmp/tmux-buffer"'
# context view; show dialog near links
#bind-key Y capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < /tmp/tmux-buffer"'
#}}}
#-------- Fuzzy Finder {{{
#------------------------------------------------------
bind-key b split-window "tmux lsw | percol --initial-index $(tmux lsw | awk '/active.$/ {print NR-1}') | cut -d':' -f 1 | tr -d '\n' | xargs -0 tmux select-window -t"
bind-key B split-window "tmux ls | percol --initial-index $(tmux ls | awk \"/^$(tmux display-message -p '#{session_name}'):/ {print NR-1}\") | cut -d':' -f 1 | tr -d '\n' | xargs -0 tmux switch-client -t"
bind-key -n 'C-\' new-window -n bookmarks \; send-keys "fzf-surfraw && tmux kill-window\n"
bind-key -n 'C-]' new-window -n playonlinux \; send-keys "fzf-playonlinux && tmux kill-window\n"
bind-key -n 'M-\' new-window -n locate \; send-keys "fzf-locate && tmux kill-window\n"
bind-key -n C-Space new-window -n applauncher \; send-keys "fzf-dmenu && tmux kill-window\n"
bind-key "'" new-window -n snippet \; send-keys "fzf-snippet && tmux kill-window\n"
bind-key '"' new-window -n multisnippet \; send-keys "fzf-multisnippet && tmux kill-window\n"
# bind-key -n C-M-Space new-window -n clipboard \; send-keys 'fzf-clipboard && tmux kill-window' 'Enter'
#Tmux Plugin stuff
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'jbnicolai/tmux-fpp'
set -g @fpp-key 'F'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm/tpm'