-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaudai.tmux.conf
312 lines (238 loc) · 10.4 KB
/
laudai.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# _ ____
# \_|_) (| \ o
# | __, | | __,
# _| / | | | _| |/ | |
# (/\___/\_/|_/ \_/|_/ (/\___/ \_/|_/|_/
#
# Github : https://github.com/laudai
# Medium : https://laudaihe.medium.com/
# All configure can run in tmux 3.0a version
#set -g prefix C-a
# to set options you can use the set-option command , set-option abbreviation is set
set -g prefix ^a
#^a means C-a
# -g switch ,for "global"
unbind ^b
#Free the original Ctrl-b prefix keybinding
set -s escape-time 1
#setting the delay between prefix and command
#讓你在command與前綴間所留的時間,以免跟vim與其他程式等衝突
bind r source-file ~/.tmux.conf \; display "Config Reload!!"
#bind-key -n C-r source-file ~/.tmux.conf \; display "Config Reload from no prefix"
#bind-key -n ^r source-file ~/.tmux.conf \; display "Config Reload from no prefix"
#bind -n ^s display "Config Reload from no prefix"
#u can use bind -n to no press prefix
#Test for no prefix
bind C-a send-prefix
#Ensure that we can send Ctrl-a to other app
#讓其他的程式也可以收到ctrl+a
bind | split-window -h
bind _ split-window -v
#splitting panes with | and _
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
#use the -r flag is more efficient to me //laudai
# Quick window selection and repeat
bind -r C-p previous-window
bind -r C-n next-window
# equal select-window -t:+/-
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
bind -n C-S-Up resize-pane -U 50
bind -n C-S-Down resize-pane -D 50
bind -n C-S-Left resize-pane -L 50
bind -n C-S-Right resize-pane -R 50
#Pane resizing panes with Prefix H,J,K,L
#when you use bind -r , you can specify that you want the key to be repeatable
set -g repeat-time 600
# default is 500
#by -r option of bind-key.Bydefault is 500ms
#這個是要讓你設定如果不要前綴鍵的指令時,可以有多少的間隔時間讓你操作
bind -r Tab select-window -t :+
#Select the next pane using "Tab"
#In terminal you can type $tput colors
#to get numbers of colors supported by your terminal session.
set -g default-terminal "screen-256color"
#Set the default terminal mode to 256color mode
#default is 8 color
set -g history-limit 5000
# set scrollback history to 5000(5k) , default is 2000
# bind T swap-window -t 1
# Make the current window the first window
### Custom mine tmux pane,window###
setw -g pane-border-style fg=colour238,bg=default
setw -g pane-active-border-style fg=magenta,bg=default
#colors for pane borders
#setw -g window-style fg=colur240,bg=colour235
#setw -g window-activate-style fg=white,bg=black
## active pane normal , other shaded out
#原作者是希望讓當下激活的亮的,其餘沒激活的顏色是暗的
set -g message-style fg=colour47,bold,bg=colour235
#Command / message line
#讓你輸入指令或者是顯示指令的地方的顏色
#fg =foreground ,bg=background
#default is fg=black , bg=green
### Custom mine tmux Status Line's Content ###
set -g status-keys vi
# default is emacs
set -g base-index 1
#Set the base index for windows to 1 instead of 0
setw -g pane-base-index 1
#Set the base inidex for panes to 1 instead of 0
#set-window-option abbreviation is setw
set -g status-interval 1
#Update the status line every seconds
#mind that if u have shell command ,those will be executed once per interval
#so be careful not to load too many resource-intensive scripts.
set -g status-style fg=white,bg=colour235
#set the status line's color
#這裡設定的是全部的預設值,如果其他設定值是default,那麼就會吃這裡的設定值
setw -g window-status-style fg=colour102,bg=default
#set the color of the window list
#設定 1 2 3 4 等等索引地方的顏色
setw -g window-status-current-style fg=red,bold,underscore,bg=default
#set colors for the active window
#設定當前激活的視窗索引的顏色與背景顏色
set -g status-left-length 80
set -g status-left " #[fg=colour160]#S #[fg=colour209]視窗:#I #[fg=colour220]窗格:#P #[fg=colour34]#(bash $DOTFILE/tmux_script/get_net_status.sh)"
# show the session name, windows number, pane number, net interface & IP Address
# ref: https://zanshin.net/2013/09/05/my-tmux-configuration/
set -g status-right-length 80
set -g status-right "#{prefix_highlight}#[fg=default]#{net_speed} #{cpu_fg_color}CPU:#{cpu_icon} #{cpu_percentage} #[fg=colour111]\"#H\" #[fg=colour82]%H:%M:%S #[fg=colour208]%m/%d %a #[fg=colour244]"
if-shell "dmesg | grep -e 'battery present' > /dev/null" "set -g status-right '#{prefix_highlight}#[fg=default]#{net_speed} #{cpu_fg_color}CPU:#{cpu_icon} #{cpu_percentage} #[fg=colour111]\"#H\" #[fg=colour82]%H:%M:%S #[fg=colour208]%m/%d %a #[fg=colour244]#{battery_status_bg}Batt:#{battery_icon}#{battery_percentage}'"
#Status line right side to show "D:193 B/s U:327 B/s CPU:= 4.4% "ldv" 18:41:00 07/03 六 Batt:🔌100%"
set -g status-justify centre
#Center the window list in the status line
setw -g monitor-activity on
setw -g window-status-activity-style fg=colour169,bg=default
#設定開啟監控視窗,設定被監控視窗的前景與後景顏色
set -g visual-activity on
#當被監控的視窗有新事件的時候,會在下方顯示
#enable activity alerts
### make my configuration with text and buffers ###
setw -g mode-keys vi
# Use vi style key bindings in copy mode .
# Default is emacs .
bind = choose-buffer
#bind = show-buffer
# my choose-buffer use = key and default also use = to choose-buffer
# all my copy text and buffers setting via plugin tmux-yank
#### make my Workflows and my shortcuts key ###
bind - split-window -v -c "#{pane_current_path}"
bind \\ split-window -h -c "#{pane_current_path}"
# split pane and retain the current directory of existing pane
bind C new-window -a -c "#{pane_current_path}"
# bind C to new window and in current path
# With -a, the new window is inserted at the next index up from the specified target-window
bind -n M-s set-window-option synchronize-panes \; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# shortcut for synchronize-panes toggle
### set your configure and your keybinding
### 設定我自己設定的configure 和 bind key
# in comment are the tmux default setting
# set -g default-command ""
set -g display-panes-time 1000
set -g display-time 1500
# M- which is the Meta key (i.e. Alt on most keyboards)
# Refer : http://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/
set -g set-titles off
# default is off
#set -g set-titles-string "#S:#I:#W - "#T" #{session_alerts}"
setw -g automatic-rename on
#rename window to reflect current program
set -g renumber-windows on
#renumber windows when a window is closed
# mouse support -set to no if u want to use the mouse
# refer from github appleboy/dotfiles
# Toggle mouse on
bind m \
set -g mouse on \; display "Set Mouse: ON"
# Toggle mouse off
bind M \
set -g mouse off \; display "Set Mouse: OFF"
bind C-k confirm-before -p "kill-window #W? (y/n)" kill-window
bind M-k confirm-before -p "kill-session #S? (y/n)" kill-session
unbind -n C-o
bind -r C-o rotate-window
bind -r M-o rotate-window -D
bind -n M-| select-layout main-vertical
bind -n M-_ select-layout main-horizontal
bind -n C-\\ select-layout even-horizontal
bind -n C-_ select-layout even-vertical
bind -n C-t select-layout tiled
bind C-t choose-window "join-pane -h -t '%%'" \;\
display "Join pane to some window via choose-window"
bind C-j command-prompt -p "Join pane from :" "join-pane -h -s ':%%'"
bind -r \{ swap-pane -U
bind -r \} swap-pane -D
# https://superuser.com/questions/1079462/tmux-keybinding-to-swap-pane-left-or-right/1080429
bind M-v swap-pane -s '!' -t $TMUX_PANE # swap current pane with last visited pane
bind -r C-Right swap-pane -s '{right-of}'
bind -r C-Left swap-pane -s '{left-of}'
bind -r C-Up swap-pane -s '{up-of}'
bind -r C-Down swap-pane -s '{down-of}'
bind M-f \
set -g repeat-time 600 \;\
set -g set-titles off \;\
set -g display-time 750 \;\
display "set repeat 0.6s , titles off , display 0.75s"
unbind M-n
# default M-n next-window -a
bind M-n \
set -g repeat-time 1000 \;\
set -g set-titles on \;\
set -g display-time 1500 \;\
display "set repeat 1s , titles on , display 1.5s"
bind S command-prompt -p "new session name:" "new-session -s '%%'"
#bind S command-prompt "new-session -s '%%'"
bind T movew \; display "move window to next unsed number"
bind @ command-prompt -p "change window index to :" "move-window -t '%%'"
# move window to next unused number , move-window abbreviation is movew
bind -n M-0 select-pane -t:.0
bind -n M-1 select-pane -t:.1
bind -n M-2 select-pane -t:.2
bind -n M-3 select-pane -t:.3
bind -n M-4 select-pane -t:.4
bind -n M-5 select-pane -t:.5
bind -n M-6 select-pane -t:.6
bind -n M-7 select-pane -t:.7
bind -n M-8 select-pane -t:.8
bind -n M-9 select-pane -t:.9
# select current window's pane , select-pane abbreviation is selectp
unbind o
bind o kill-pane -a \; display "kill all panes but the current pane in this window"
bind -r O select-pane -t :.+
bind / last-window
# last-window abbreviation is last
bind C-b send-keys "clear && tmux clear-history" \; send-keys "Enter" \;\
display "clear tmux terminal screen like printf '\\033c'"
# clear tmux ternimal screen & buffer
bind M-s command-prompt -p "swap window index to :" "swap-window -t '%%'"
if-shell "uname -n | grep -q raspberry" "set -g default-shell /usr/bin/zsh"
set -g default-shell /usr/bin/zsh
#set -g @shell_mode 'vi'
# after tmux2.4 , you will not need this setting.
set set-clipboard on
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-net-speed'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-copycat'
# Plugin Set
set -g @net_speed_format "D:%5s U:%5s"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'