forked from jessarcher/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
252 lines (184 loc) · 8.34 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
################################################################################
# General
################################################################################
# utf-8 on
set -gq utf8 on # Tmux < 2.2
set -gq status-utf8 on # Tmux < 2.2
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# Increase scrollback buffer size
set -g history-limit 10000
# Use Vi mode
setw -g mode-keys vi
# emacs key bindings in tmux command prompt (prefix + :) are better than vi keys, even for vim users
set -g status-keys emacs
# Allow automatic renaming of windows
set -g allow-rename on
# Renumber windows when one is removed.
set -g renumber-windows on
# Set a terminal that apps will know how to handle
#set -g default-terminal "screen-256color"
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# Enable the mouse for scrolling
set -gq mode-mouse on # Tmux < 2.1
set -gq mouse on # Tmux >= 2.1
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# Enable mouse for selecting and resizing
set -gq mouse-select-window on # Tmux < 2.1
set -gq mouse-select-pane on # Tmux < 2.1
set -gq mouse-resize-pane on # Tmux < 2.1
# Allow tmux to set the titlebar
set -g set-titles on
# Start window and pane numbering from 1 for easier switching
set -g base-index 1
setw -g pane-base-index 1
# How long to display the pane number on PREFIX-q
set -g display-panes-time 3000 # 3s
# How long to wait for repeated keys bound with bind -r
set -g repeat-time 2000 # 2s
# Monitor window activity to display in the status bar
set-window-option -g monitor-activity on
# A bell in another window should cause a bell in the current window
set -g bell-action any
# Don't show distracting notifications
set -g visual-bell off
set -g visual-activity off
# 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
# don't detach tmux when killing a session
set -g detach-on-destroy off
#set -g lock-command "nice -n 20 cmatrix -s -b"
#set -g lock-after-time 600
#set -g lock-server on
################################################################################
# Key Binding
################################################################################
# -r means that the bind can repeat without entering prefix again
# -n means that the bind doesn't use the prefix
# Ensure prefix is Ctrl+B
set -g prefix C-Space
# Send prefix to a nested tmux session by doubling the prefix
bind C-Space send-prefix
# 'PREFIX r' to reload of the config file
unbind r
bind r source-file ~/.tmux.conf\; display-message '~/.tmux.conf reloaded'
# Allow holding Ctrl when using using prefix+p/n for switching windows
bind C-p previous-window
bind C-n next-window
# Move around panes like in vim
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(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"'"
# Switch between previous and next windows with repeatable
bind -r n next-window
bind -r p previous-window
# Move the current window to the next window or previous window position
bind -r N run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) + 1)"
bind -r P run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) - 1)"
# Switch between two most recently used windows or panes
bind Space last-window
#bind Space last-pane
# bind Space if-shell 'test #{window_panes} -gt 1' 'last-pane' 'last-window'
# use PREFIX+| (or PREFIX+\) to split window horizontally and PREFIX+- or
# (PREFIX+_) to split vertically also use the current pane path to define the
# new pane path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Change the path for newly created windows
bind c new-window -c "#{pane_current_path}"
# Setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
'bind-key -T copy-mode-vi v send-keys -X begin-selection;'
################################################################################
# Status Line
################################################################################
#set -g status-interval 5
# set -g status-fg white
# set -g status-bg colour18
# set -g status-style "bg=colour18,fg=white"
# set -g status-justify "centre"
#set -g status-style fg=white,bg=colour18
# Status Left
#############
# set -g status-left-length 80
# set -g status-left "#[fg=colour18,bg=colour4,bold] #S #[fg=colour4,bg=colour19,nobold]"
# set -ag status-left "#[fg=colour7,bg=colour19] #I:#P #[fg=colour19,bg=colour18]"
# Window Status
###############
# set-window-option -g window-status-separator ""
# set-window-option -g window-status-activity-style "fg=red"
# set-window-option -g window-status-bell-style "fg=green"
set-window-option -g window-status-format " #(~/.dotfiles/scripts/tmux.sh -cmd #W) #W"
set-window-option -ag window-status-format "#(~/.dotfiles/scripts/tmux.sh -num #I) "
# set-window-option -g window-status-current-format "#[fg=colour18,bg=colour19]#[fg=colour7] "
# set-window-option -ag window-status-current-format "#(~/.dotfiles/scripts/tmux.sh -cmd #W) #W"
# set-window-option -ag window-status-current-format "#(~/.dotfiles/scripts/tmux.sh -num #I) "
# set-window-option -ag window-status-current-format "#[fg=colour19,bg=colour18]"
# Status Right
##############
# set -g status-right-length 80
# set -g status-right "#[fg=colour19,bg=colour18]"
# set -ag status-right "#[fg=colour7,bg=colour19] "
# Date
# set -ag status-right "#(date '+%Y-%m-%d %H:%M')"
# Mail count
# set -ag status-right "#(~/.dotfiles/scripts/tmux.sh -mail)"
# Separator
#set -ag status-right "#[fg=colour18] #[fg=colour7]"
# CPU usage
#set -ag status-right "#(~/.dotfiles/scripts/tmux.sh -cpu)"
# Separator
#set -ag status-right "#[fg=colour18] #[fg=colour7]"
# Memory usage
#set -ag status-right "#(~/.dotfiles/scripts/tmux.sh -mem) "
# Whoami with "prefix active" indicator
# set -ag status-right "#[fg=colour4,bg=colour19]"
# set -ag status-right "#[fg=colour18,bg=colour4,bold] #{?client_prefix,,} #(whoami)@#h "
################################################################################
# Borders
################################################################################
# Inactive border
# set-window-option -g pane-border-fg colour18
# set-window-option -g pane-border-bg colour18
# Active border
# set-window-option -g pane-active-border-fg colour19
# set-window-option -g pane-active-border-bg colour19
################################################################################
# Other configs
################################################################################
# OS X
if-shell 'test "$(uname)" = "Darwin" && [ -f ~/.tmux_darwin.conf ]' 'source ~/.tmux_darwin.conf'
# Linux
if-shell 'test "$(uname)" = "Linux" && [ -f ~/.tmux_linux.conf ]' 'source ~/.tmux_linux.conf'
# Local overrides
if-shell "[ -f ~/.tmux_local.conf ]" 'source ~/.tmux_local.conf'
################################################################################
# Plugins
################################################################################
# Plugin list
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-urlview'
# set -g @plugin 'jessarcher/tmux-onedark-theme'
set -g @plugin 'sei40kr/tmux-airline-dracula'
set -g @onedark_widgets ""
set -g @onedark_time_format "%H:%M"
set -g @onedark_date_format "%Y-%m-%d"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'