-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
201 lines (154 loc) · 6.61 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
# fix problem with vim colorscheme in tmux
# http://stackoverflow.com/questions/10158508/lose-vim-colorscheme-in-tmux-mode
# set -g default-terminal "rxvt"
# this fixes the HOME and END key problem
# set -g default-terminal "screen-256color"
# set -g default-terminal "rxvt-unicode-256color"
# set-option -g default-terminal "tmux-256color"
set-option -g default-terminal "xterm-256color"
set-option -g default-terminal "tmux-256color"
# Needs this line also to overrides the default color, so that the neovim color
# themes work correctly
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -g default-shell /bin/zsh
set-option -g default-command /bin/zsh
set-option -g status-keys vi
set-window-option -g mode-keys vi
# On utf8. Update 2016-09-30: no longer necessary
# set -g utf8 on
# set-option -g status-utf8 on
# set-window-option -g utf8 on
# Change prefix to Ctrl+a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
# address vim mode switching delay (http://superuser.com/a/252717/65504)
# https://github.com/tmux-plugins/tmux-sensible
set -s escape-time 0
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 2 seconds
set -g display-time 2000
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# y and p as in vim
bind Escape copy-mode
unbind p
bind p paste-buffer
# bind -t vi-copy 'v' begin-selection
# bind -t vi-copy 'y' copy-selection -x
# Copy selection to system clipboard (make sure xclip is installed)
# It seems xclip does not close STDOUT after it has read from tmux's buffer. As
# such, tmux doesn't know that the copy task has completed, and continues to
# /await xclip's termination, thereby rendering the window manager unresponsive.
# So we redirect STDOUT of xclip to /dev/null, or you can use an
# alternative command like xsel (https://wiki.archlinux.org/index.php/Tmux)
# bind-key -t vi-copy y copy-pipe 'xclip -in -selection clipboard >/dev/null'
# bind -t vi-copy 'Space' halfpage-down
# bind -t vi-copy 'Bspace' halfpage-up
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
bind-key C run-shell "TMUX= tmux new-session -d -s $($PWD | awk 'F' '/' ' {print $NF}' \; ) \;"
# ==============================================================================
#---begin Window and Pane shortcut keys
# easy-to-remember split pane commands
# Start windows and panes at 1, not 0, to match with vim and bspwm
set -g base-index 1
set -g pane-base-index 1
# Split/create new pane with current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# move the current pane TO become a new window
bind T break-pane
# move the current window BACK to a window to join as a pane
# -h : split vertical?
bind B command-prompt -p "Send pane BACK to: " "join-pane -h -t '%%'"
## swapping:
bind-key J swap-pane -D
bind-key K swap-pane -U
bind-key H swap-pane -U
bind-key L swap-pane -D
# rotate layout with `C-r`
bind -r C-r next-layout
# Use F10 to toggle zoom the current pane
bind-key -n F10 resize-pane -Z
# moving between windows with vim movement keys
# Press the prefix (Ctrl+a) then hold Ctrl key and press h or l to cycle through
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Use Ctrl+[0..9] to select window in tmux
bind -n C-0 select-window -t :10
bind -n C-1 select-window -t :1
bind -n C-2 select-window -t :2
bind -n C-3 select-window -t :3
bind -n C-4 select-window -t :4
bind -n C-5 select-window -t :5
bind -n C-6 select-window -t :6
bind -n C-7 select-window -t :7
bind -n C-8 select-window -t :8
bind -n C-9 select-window -t :9
bind -n C-Tab last-window
# resize panes with similar key binding with my vim settings
bind -r M-h resize-pane -L 5
bind -r M-j resize-pane -D 5
bind -r M-k resize-pane -U 5
bind -r M-l resize-pane -R 5
#---end Window and Pane shortcut keys
# ==============================================================================
##+ window title:
set-option -g set-titles on
set-option -g set-titles-string '[#S:#I] #W'
set-window-option -g automatic-rename on
# Set window notifications
setw -g monitor-activity off
set -g visual-activity off
# split pane border style
set -g pane-border-style fg=blue
set -g pane-active-border-style fg=yellow
set -g pane-border-style bg=blue
set -g pane-active-border-style bg=yellow
# set -g pane-border-fg yellow
# set -g pane-active-border-fg yellow
# set -g pane-active-border-bg yellow
set -g status-left-length 170
set -g status-justify 'centre'
set -g status-left '#[fg=#e5e5e5,bg=colour238,nobold,nounderscore,noitalics] %R #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=#00bfff,bg=colour235] #(uptime -p) #[fg=#ffffff,bg=colour235]#[fg=#00b71b,bg=colour235] @#H #[fg=colour235,bg=default,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=colour238,bg=default]#[fg=#e5e5e5,bg=colour238] #S '
set -g status-right-length 100
set -g status-bg default
# #P: the pane number
setw -g window-status-format '#[fg=colour236,bg=default]#[fg=#aaaaaa,bg=colour236] #I #[fg=#aaaaaa,bg=colour236] #W #P #[fg=colour236,bg=default]'
setw -g window-status-current-format '#[fg=#774100,bg=default]#[fg=colour236,bg=#774100] #I #[fg=#774100,bg=#ff8c00]#[fg=colour236,bg=#ff8c00] #W #P #[fg=#ff8c00,bg=default]'
# Faster Command Sequences, fix neovim switching to command mode problem?
# set -s escape-time 0
set -g escape-time 10
# allow Neovim in tmux to change cursor shape to vertical bar in insert mode
# previously it worked fine, but after neovim commit 0e546d8 we need the below
# See `man nvim`
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-sessionist'
# set -g @plugin 'jbnicolai/tmux-fpp'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin './.tmux/plugins/tmux-fzf-url-fire'
set -g @plugin './.tmux/plugins/tmux-fzf-url-qute'
## RESSURECT BETWEEN RESTARTS
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'
run -b '~/.tmux/plugins/tpm/tpm'