-
Notifications
You must be signed in to change notification settings - Fork 2
/
tmux.conf
261 lines (199 loc) · 9.13 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
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -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"
# increase scroll-back history
set -g history-limit 5000
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
# set -g status-keys vi
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
set -g status-keys emacs
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
# 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
# disable mouse
# setw -g mode-mouse off
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
set -g base-index 1
# start pane index at 1
setw -g pane-base-index 1
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# re-number windows when one is closed
set -g renumber-windows on
###########################
# Key Bindings
###########################
# tmux prefix
unbind C-b
set -g prefix C-a
bind a send-prefix
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
bind-key ^S choose-tree
# window splitting
unbind %
# bind | split-window -h
unbind '"'
# bind - split-window -v
# Create splits and vertical splits
bind-key v split-window -h -l 50% -c "#{pane_current_path}"
# bind-key ^V split-window -h -p 50 -c "#{pane_current_path}"
bind-key s split-window -l 50% -c "#{pane_current_path}"
# bind-key ^S split-window -p 50 -c "#{pane_current_path}"
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
# is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(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"
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L'
bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# easier and faster switching between next/prev window
# bind C-p previous-window
# bind C-n next-window
bind-key -n M-h previous-window
bind-key -n M-l next-window
# bind-key -n C-S-Left swap-window -t -1
# bind-key -n C-S-Right swap-window -t +1
# Moving windows
bind-key -r > swap-window -t :+
bind-key -r < swap-window -t :-
# https://github.com/tmux/tmux/issues/592
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
#bind-key -Tcopy-mode-vi 'y' send -X copy-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
###########################
# Status Bar
###########################
# enable UTF-8 support in status bar
# set -g status-utf8 on
# set refresh interval for status bar
set -g status-interval 30
# center the status bar
set -g status-justify centre
# show session, window, pane in left status bar
# set -g status-left-length 40
# set -g status-left '#[fg=green]#S#[fg=blue] #I:#P#[default]'
# show hostname, date, time, and battery in right status bar
# set-option -g status-right '#[fg=green]#H#[default] %m/%d/%y %I:%M\
# #[fg=red]#(battery discharging)#[default]#(battery charging)'
###########################
# Colors
###########################
## 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-window-option -g window-status-bg colour214 #yellow
# set-window-option -g window-status-fg colour237 #bg1
# set-window-option -g window-status-activity-bg colour237 #bg1
# set-window-option -g window-status-activity-fg colour248 #fg3
# active window title colors
# set-window-option -g window-status-current-bg default
# set-window-option -g window-status-current-fg colour237 #bg1
# pane border
# set-option -g pane-active-border-fg colour250 #fg2
# set-option -g pane-border-fg colour237 #bg1
# message infos
# set-option -g message-bg colour239 #bg2
# set-option -g message-fg colour223 #fg1
# writting commands inactive
# set-option -g message-command-bg colour239 #fg3
# set-option -g message-command-fg colour223 #bg1
# 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 colour109 #blue
# bell
# set-window-option -g window-status-bell-style fg=colour235,bg=colour167 #bg, red
## Theme settings 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-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
# set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248] #h "
set -g status-left "#S"
# set -g status-right ' #{?client_prefix,💭#[noreverse] ,}#{?window_zoomed_flag,🔍,}'
set -g status-right ' #{?client_prefix,@#[noreverse] ,}#{?window_zoomed_flag,+,}'
set-option -g status-style fg=white,bg=default,default
set-window-option -g mode-style fg=white,bg='#212121'
set-window-option -g window-status-style bg=default,default
set-window-option -g window-status-current-style fg=magenta,bg=default,default
set-option -g message-style fg=white,bg=default,bright
set-option -g status-left-style fg=white
# setw -g window-status-current-fg colour1
# setw -g window-status-current-bg colour19
# setw -g window-status-current-attr bold
setw -g window-status-current-format ' #[fg=colour255]#W#[fg=colour249]#F '
# setw -g window-status-current-format ' #W#F '
# setw -g window-status-fg colour9
# setw -g window-status-bg colour18
# setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# setw -g window-status-format ' #I:#W#F '
# set-window-option -g window-status-current-format "#[fg=colour239, bg=colour248, :nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
# set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
# enable pbcopy and pbpaste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# system config
if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux/tmux-osx.conf'
if-shell 'test "$(uname)" = "Linux"' 'source ~/.tmux/tmux-linux.conf'
###########################
# TPM
###########################
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'christoomey/vim-tmux-navigator'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
# Load plugins
if-shell "[ -f ~/.tmux/plugins.conf ]" 'source ~/.tmux/plugins.conf'
# Local config
if-shell "[ -f ~/.tmux.local.conf ]" 'source ~/.tmux.local.conf'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'