-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtmux.conf
223 lines (175 loc) · 6.85 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
##################
# General Settings
##################
# Tell tmux to use zsh
set-option -g default-shell $SHELL
# Run wrapper reattach-to-user-namespace if it exists
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
set-option -g default-command 'command -v reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace -l "$SHELL" || exec "$SHELL"'
set -g focus-events on
# Set color TERM
set -g default-terminal "screen-256color"
# Enable 24-bit color and italics terminal compability
set-option -ga terminal-overrides "xterm-256color:Tc"
# Enable 24-bit color and italics terminal compability
set-option -sa terminal-overrides 'xterm-256color:RGB'
# Act like Vim
set-window-option -g mode-keys vi
# Turn on xterm-style keybindings
set-window-option -g xterm-keys on
# Remove exit lag for insert mode in vim
set-option -s escape-time 0
# Make it use C-a, similar to screen...
unbind C-b # don't use control-b to invoke
set -g prefix C-a # use control-a instead
bind C-a send-prefix # but restore control-a readline binding by pressing control-a twice
# Reload tmux config with control-a r
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file."
# Increase scrollback buffer size
set -g history-limit 50000
########
# Splits
########
# Split panes with "control-a |" and "control-a \ or control-a -"
unbind %
bind \| split-window -h
bind - split-window -v
bind \\ split-window -v
###############
# Mouse Support
###############
# Enable mouse support (works in iTerm)
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
################
# Copy and Paste
################
setw -g mode-keys vi
bind ` copy-mode #`
unbind [
unbind p
bind p paste-buffer
bind -T vi-copy v send -X begin-selection
bind -T vi-copy y send -X copy-selection
bind -T vi-copy Escape send -X cancel
bind y run "tmux save-buffer - | pbcopy"
############
# Status Bar
############
# Update the statusbar every second
set -g status-interval 1
#################
# Window Settings
#################
# Start window numbering at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# Make window naming stick
# (rename a window with C-a ,)
set-option -g allow-rename off
##############
# Key Bindings
##############
bind k confirm kill-window
bind K confirm kill-server
bind x confirm kill-pane
bind X confirm kill-session
# Use shift + up/down arrows to re-order windows
bind -n S-up swap-window -t -1
bind -n S-down swap-window -t +1
# Use shift + left/right to move between windows
bind -n S-left prev
bind -n S-right next
# Smart pane switching with awareness of vim splits
# when paired with christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
##################
# fzf-goto-session
##################
# Override the default session handler with fzf-goto-session
set -g @fzf-goto-session 's'
set-option -g @fzf-goto-session-only 'true'
set -g @fzf-goto-session-without-prefix 'false'
set -g @fzf-goto-win-height 10
set -g @fzf-goto-win-width 60
# 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
################
# Terminal Title
################
# Turn on window titles
set -g set-titles on
# Set window title to "Session Name"
set -g set-titles-string '#S'
# Automatically rename the window titles
setw -g automatic-rename on
# Monitor for activity in other windows
setw -g monitor-activity off
# # Hide activity notifications for inactive windows
set -g visual-activity off
# Change cursor in vim to distinguish between insert and command mode
# Use in conjunciton with pivotal/tmux-cursors.vim
# set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
set-option -g renumber-windows on
#######
# Theme
#######
set -g status-bg '#282a2e'
set -g message-command-style fg='#b4b7b4',bg='#373b41'
set -g status-justify "left"
set -g status-left-length "100"
set -g status "on"
set -g message-style fg='#b4b7b4',bg='#373b41'
set -g status-style "none"
set -g status-right-length "100"
set -g status-right-style "none"
set -g status-left-style "none"
setw -g window-status-style fg='#969896',bg='#282a2e'
setw -g window-status-style "none"
setw -g window-status-activity-style bg='#282a2e',underscore,fg='#969896'
setw -g window-status-separator ""
set-option -g pane-active-border-style fg='#262626',bg='#262626'
set-option -g pane-border-style fg='#262626',bg='#262626'
set -g status-left "#[fg=#373b41,bg=#b4b7b4] [#S] #[fg=#b4b7b4,bg=#282a2e,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#373b41,bg=#282a2e,nobold,nounderscore,noitalics]#[fg=#b4b7b4,bg=#373b41] #(/bin/bash ~/.config/kube-tmux/kube.tmux 250 red cyan) #[fg=#b4b7b4,bg=#373b41]#[fg=#373b41,bg=#b4b7b4] %H:%M %b %d "
setw -g window-status-format "#[fg=#282a2e,bg=#282a2e,nobold,nounderscore,noitalics]#[fg=white] #I:#W #[fg=#282a2e,bg=#282a2e,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#282a2e,bg=#373b41,nobold,nounderscore,noitalics]#[fg=#b4b7b4,bg=#373b41] #I:#W #[fg=#373b41,bg=#282a2e,nobold,nounderscore,noitalics]"
###########################
# Machine-specific Settings
###########################
run "touch ~/.tmux.local"
source ~/.tmux.local
#####################
# Tmux Plugin Manager
#####################
# List of plugins
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'spywhere/tmux-named-snapshot'
set -g @plugin 'thuanowa/tmux-fzf-session-switch'
set -q @named-snapshot-save "C-s:#S"
set -q @named-snapshot-restore "C-r:#S"
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-boot-options 'iterm,fullscreen'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.config/tpm/tpm'