-
Notifications
You must be signed in to change notification settings - Fork 6
/
.tmux.conf
291 lines (223 loc) · 11.5 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
###########################################################################
############ TMUX CONFIG FILE ###############
###########################################################################
################ Start of all the settings #################
############### Settings ##############{{{
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-x
bind-key C-x send-prefix
# change the location of the statusline
# set-option -g status-position top
# No delay for escape key press
set -sg escape-time 0
# split panes using | and -
bind 3 split-window -h
bind 2 split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind-key r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
set -g status-keys vi
setw -g mode-keys vi
setw -g monitor-activity on
# Vim style pane selection
# bind h select-pane -L
# bind j select-pane -D
# bind k select-pane -U
# bind l select-pane -R
# switch windows
bind-key -n M-f next-window
# bind-key -n M-b previous-window
# fallback
# bind-key C-h select-pane -L
# bind-key C-j select-pane -D
# bind-key C-k select-pane -U
# bind-key C-l select-pane -R
# bind-key C-\ select-pane -l
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# resize panes
bind-key h resize-pane -L 5
bind-key l resize-pane -R 5
bind-key j resize-pane -D 5
bind-key k resize-pane -U 5
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# nvim warning - checkhealth
set-option -g focus-events on
# use vi keys
set-option -gw mode-keys vi
# set escape time so vim is responsive inside tmux
set-option -g escape-time 1
# make new panes and windows use the pwd
bind-key C-v split-window -h -c "#{pane_current_path}"
bind-key C-x split-window -v -c "#{pane_current_path}"
bind-key C-b split-window -v -l 10 -c "#{pane_current_path}"
bind-key C-c new-window -c "#{pane_current_path}"
# smart pane switching with awareness of vim splits
# makes ctrl-j and ctrl-k navigate fzf search results when fzf active in pane
# providing the same behavior as ctrl-j and ctrl-k when navigating ctrl-p
# results inside vim.
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind-key -n C-h if-shell "$is_vim || $is_fzf" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim || $is_fzf" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim || $is_fzf" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim || $is_fzf" "send-keys C-l" "select-pane -R"
bind-key -n C-BSpace if-shell "$is_vim || $is_fzf" "send-keys C-\\" "select-pane -l"
# copy and paste
bind-key y copy-mode
bind-key p paste-buffer
# copy mode bindings
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection primary"
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi Escape send-keys -X cancel
# open map page
bind-key C-m command-prompt "split-window -h 'man %%'"
# display panes
bind-key C-d display-panes
# toggle status bar
bind-key C-s set-option status
# mouse support
set-option -g mouse on
# set bigger history limit
set-option -g history-limit 1000000
# 256 color support
set-option -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-termite:Tc,xterm-kitty:Tc,xterm-256color:Tc"
set-option -ga terminal-overrides ",*col*:Tc"
# Name the window after creating it
# bind-key c command-prompt -p "Window name:" "new-window; Rename window '%%'"
# rename session / window / panel
bind-key M-S command-prompt -p "Rename session:" -I '#S' 'rename-session %1'
bind-key M-W command-prompt -p "Rename window:" -I '#W' 'rename-window %1'
bind-key M-P command-prompt -p "Rename pane:" -I '#T' 'rename-pane %1'
bind-key $ command-prompt -p "Rename session:" -I '#S' 'rename-session %1'
bind-key , command-prompt -p "Rename window:" -I '#W' 'rename-window %1'
# so you don't end up with window numbers like: 0 1 4 5 6
set-option -g renumber-windows on
# start window numbers from 1
set-option -g base-index 1
# wrap search
set-option -g wrap-search on
# toggle pane border status
bind-key C-t set-option -g pane-border-status
# toggle synchronize
bind-key ^ set-window-option synchronize-panes
# status bar redraw interval
set-option -g status-interval 5
# kill session / window
bind-key X kill-session
bind-key K kill-window
# Move window
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
#}}}
################ THEME ################## {{{
# set -g status-bg black
# set -g status-fg white
# set -g window-status-current-style bg=white,fg=black,bold
# set -g status-interval 60
# set -g status-left-length 30
# set -g status-left '#[fg=green](#S) #(whoami)'
# set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
#}}}
############### STATUSBAR ############### {{{
# COLORSCHEME: gruvbox dark
set-option -g status "on"
# default statusbar colors
set-option -g status-bg colour237 #bg1
set-option -g status-fg colour223 #fg1
# default window title colors
set -g window-status-style bg=colour246,fg=colour237 #gray
set -g window-status-activity-style bg=colour237,fg=colour248 #bg1
# active window title colors
set -g window-status-current-style bg=default,fg=colour237
# pane border
set -g pane-active-border-style fg=colour241 #bg3
set -g pane-border-style fg=colour241 #bg3
# message infos
set -g message-style bg=colour239,fg=colour223
# writting commands inactive
set -g message-command-style bg=black,fg=colour223 #fg3
# pane number display
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1
# clock
set-window-option -g clock-mode-colour colour246 #gray
set-window-option -g clock-mode-style 12
# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour167 #bg, red
# theme set-optiontings mixed with colors (unfortunately, but there is no cleaner way)
# set-option -g status-attr "none"
set-option -g status-justify "left"
# set-option -g status-left-attr "none"
set-option -g status-left-length "80"
# set-option -g status-right-attr "none"
set-option -g status-right-length "80"
# set-window-option -g window-status-activity-attr "none"
# set-window-option -g window-status-attr "none"
set-window-option -g window-status-separator ""
# set-window-option -g window-status-current-format "#[fg=colour237, bg=colour246, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] #I #[fg=colour235, bg=colour246, bold] #W #[fg=colour246, bg=colour237, nobold, noitalics, nounderscore]"
# set-window-option -g window-status-format "#[fg=colour237, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour246,bg=colour239] #I #[fg=colour246, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
# Powerline
set-option -g status-left "#[fg=colour246, bg=colour239] #S #[fg=colour239, bg=colour237, nobold, noitalics, nounderscore]"
# set-option -g status-right "#[fg=colour239, bg=colour237, bold, nounderscore, noitalics]#[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] $USER@#h "
# set-option -g status-right "#[fg=colour239, bg=colour237, bold, nounderscore, noitalics]#[fg=colour246, bg=colour239] %m.%d.%Y %l:%M #[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] $USER@#h "
# set-option -g status-right "#[fg=colour239, bg=colour237, bold, nounderscore, noitalics]#[fg=colour246, bg=colour239] %m.%d.%Y - %l:%M #[fg=colour246, bg=colour239, bold, noitalics, nounderscore]#[fg=colour235, bg=colour246, bold] #h "
set-option -g status-right "#{?pane_dead,dead ,}#{?window_zoomed_flag,zoom ,}#{?pane_synchronized,sync ,}#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246, bg=colour239] #(show-short-dir \"#{pane_current_path}\" \"#{client_width}\") #[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] $USER@#h "
# set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246, bg=colour239] %d.%m.%Y %H:%M #[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246, bold] #h "
# set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246, bg=colour239] #{pane_current_path} #[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] $USER@#h "
# set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246, bg=colour239] #(show-short-dir \"#{pane_current_path}\" \"#{client_width}\") #[fg=colour246, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] $USER@#h "
# Powerline (current)
set-window-option -g window-status-current-format "#[fg=colour237, bg=colour246, nobold, noitalics, nounderscore]#[fg=colour235, bg=colour246] #I #[fg=colour235, bg=colour246, bold] #W #[fg=colour246, bg=colour237, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=colour237, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour246,bg=colour239] #I #[fg=colour246, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
#}}}
############## PLUGINS ########### {{{
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
#set-option -g @plugin 'tmux-plugins/tmux-continuum'
#set-option -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'NHDaly/tmux-better-mouse-mode'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
# plugin settings
#set-option -g @continuum-boot 'on'
#set-option -g @continuum-systemd-start-cmd 'new-session -d -s main'
#set-option -g @resurrect-strategy-vim 'session'
set-option -g @scroll-down-exit-copy-mode 'on'
set-option -g @scroll-without-changing-pane 'on'
set-option -g @scroll-in-moused-over-pane 'on'
set-option -g @scroll-speed-num-lines-per-scroll '1'
set-option -g @emulate-scroll-for-no-mouse-alternate-buffer 'on'
# Install `tpm` if needed.
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Activate the plugins.
run -b "~/.tmux/plugins/tpm/tpm"
# initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# run '~/.tmux/plugins/tpm/tpm'
#}}}