-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path89iuv.tmux.conf
263 lines (218 loc) · 10.4 KB
/
89iuv.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
# Change prefix key
if -b '[ "$SSH_CLIENT" ]' ' \
set -g status-position top; \
set -g prefix M-q; \
bind M-q resize-pane -Z; \
bind -r M-p previous-window; \
bind -r M-n next-window; \
' ' \
set -g status-position top; \
set -g prefix C-a; \
bind C-a resize-pane -Z; \
bind -r C-p previous-window; \
bind -r C-n next-window; \
'
# split current window horizontally
bind-key v split-window -h
bind | split-window -h
# split current window vertically
bind-key b split-window
bind _ split-window -v
bind -r tab select-pane -t :.+
bind -r btab select-pane -t :.-
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# Change the color of the current window/pane
bind-key T run-shell "tmux set -p window-style 'fg=#C01C28,bg=#5E5C64'"
# Select pane
bind-key h select-pane -L
bind-key l select-pane -R
bind-key j select-pane -D
bind-key k select-pane -U
setw -g mode-keys vi
set -g repeat-time 1000
# Move window
bind -r < swap-window -t -1
bind -r > swap-window -t +1
# rename session
bind-key . command-prompt -I "#S" "rename-session '%%'"
# set to main-horizontal, 66% height for main pane
bind-key m run-shell "~/.tmux/scripts/resize-adaptable.sh -l main-horizontal -p 66"
# Same thing for verical layouts
bind-key M run-shell "~/.tmux/scripts/resize-adaptable.sh -l main-vertical -p 50"
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
# Resize panes like vim
bind -r H resize-pane -L 4
bind -r L resize-pane -R 4
bind -r J resize-pane -D 4
bind -r K resize-pane -U 4
# TrueColor
set -g default-terminal "xterm-256color"
set -sa terminal-overrides ',xterm-256color:RGB'
# set -sa terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set -g history-limit 102400 # boost history
set -g display-time 4000 # tmux messages are displayed for 4 seconds
set -g status-interval 5 # refresh 'status-left' and 'status-right' more often
set -g status-keys emacs
set -g focus-events on # focus events enabled for terminals that support them
setw -g aggressive-resize on # super useful when using "grouped sessions" and multi-monitor setup
# Copy
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi C-v send -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi Escape send -X cancel
bind -T copy-mode-vi L send -X end-of-line
bind -T copy-mode-vi H send -X start-of-line
# Mouse support
set -g mouse on # 鼠标支持
# Index & Name
set -g base-index 1 # 设置窗口(window)的起始下标为1
set -g pane-base-index 1 # 设置面板(pane)的起始下标为1
set -g renumber-windows on
setw -g automatic-rename on # tmux默认会自动重命名窗口,频繁的命令行操作,将频繁触发重命名,比较浪费CPU性能
# Goyo
bind G set status
# Change default work dir
bind m attach -c '#{pane_current_path}'
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-battery' # 状态栏显示电池信息
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect' # 保存恢复会话
# set -g @plugin 'tmux-plugins/tmux-continuum' # 每隔15分钟自动保存 tmux 环境信息(不需要任何配置,默认就有)
# 重载vim/neovim会话
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
set -g @plugin 'tmux-plugins/tmux-yank' # 终端便捷剪切板功能
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'tmux-plugins/tmux-copycat' # 终端中快速搜索内容
# 其中copycat搜索插件支持正则表达式搜索/搜索结果高亮/预定义搜索
# 正则格式搜索: <prefix+/>
# 搜索结果高亮: 使用grep命令搜索且搜索不区分大小写
# 预定义的搜索:
# 1. 文件搜索 <prefix+ctrl-f>
# 2. URL搜索 <prefix+ctrl-u>
# 3. 数字搜索 <prefix+ctrl-d>
# 4. IP地址搜索 <prefix+alt-i>
# 当然可以使用n/N进行高亮选择进行一个个的跳转
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight' # 窗口信息输出
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
set -g @prefix_highlight_empty_has_affixes 'on' # default is 'off'
set -g @prefix_highlight_empty_prompt 'Tmux'
set -g @prefix_highlight_output_prefix '< '
set -g @prefix_highlight_output_suffix ' >'
set -g @plugin 'wfxr/tmux-web-reachable'
set -g @web_reachable_url 'https://google.com'
set -g @web_reachable_thresholds '500 750'
# set -g @web_reachable_symbols '🔵|🟢|🟡|🔴'
# set -g @web_reachable_symbols '🔵|🟢|🟡|🧱'
set -g @web_reachable_symbols '#[fg=Cyan] #[]|#[fg=Green] #[]|#[fg=Yellow] #[]|#[fg=Red] #[]'
set -g @plugin 'wfxr/tmux-net-speed'
set -g @tmux_power_show_upload_speed true
set -g @tmux_power_show_download_speed true
set -g @plugin 'woodstok/tmux-butler'
bind-key -n M-i run-shell -b "$HOME/.tmux/plugins/tmux-butler/modes/quetty-filter -start word"
bind-key -n M-p run-shell -b "$HOME/.tmux/plugins/tmux-butler/modes/quetty-filter -start path"
bind-key -n M-s run-shell -b "$HOME/.tmux/plugins/tmux-butler/modes/snippets"
set -g @plugin 'junegunn/tmux-fzf-maccy'
# Bind-key (default: '@')
set -g @fzf-maccy-bind 'h'
# fzf-tmux layout (default: '-p70%' on tmux 3.2, '-d' otherwise)
# (-p requires tmux 3.2 or above, see `man fzf-tmux` for available options)
set -g @fzf-maccy-layout '-p95%'
set -g @plugin 'junegunn/tmux-fzf-url'
# Bind-key (default: 'u')
set -g @fzf-url-bind 'u'
# fzf-tmux layout (default: '-p70%' on tmux 3.2, '-d' otherwise)
# (-p requires tmux 3.2 or above, see `man fzf-tmux` for available options)
set -g @fzf-url-layout '-p95%'
# if -b '"$(uname)" = Darwin' 'source-file ~/.tmux_osx.conf'
# set -g @plugin 'laktak/extrakto'
# prefix + Tab - toggle sidebar with a directory tree
# prefix + Backspace - toggle sidebar and move cursor to it (focus it)
set -g @plugin 'tmux-plugins/tmux-sidebar' # 文件目录树
# Default To launch tmux-fzf, press prefix + F (Shift+F).
set -g @plugin 'sainnhe/tmux-fzf'
# to use prefix + C-f (Ctrl+F)
TMUX_FZF_LAUNCH_KEY="C-f"
# Default value in tmux < 3.2
TMUX_FZF_OPTIONS="-m"
# Default value in tmux >= 3.2
TMUX_FZF_OPTIONS="-p -w 95% -h 75% -m"
TMUX_FZF_ORDER="session|window|pane|command|keybinding|clipboard|process"
TMUX_FZF_PANE_FORMAT="[#{window_name}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}"
# 抽出屏幕中的URL链接信息
# 在面板中显示所有URL链接地址: <prefix+p>
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @urlview-key 'p'
# The default root keybinding ctrl + space, or
# The default prefix keybinding prefix + space
set -g @plugin 'alexwforsythe/tmux-which-key'
set -g @plugin 'AngryMorrocoy/tmux-neolazygit'
set -g @open-lazygit 'g'
# set -g default-shell ${SHELL} Only for OSX
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Configure Catppuccin
set -g @catppuccin_flavor "macchiato" # latte, frappe, macchiato or mocha
set -g @catppuccin_status_background "none"
set -g @catppuccin_window_status_style "none"
set -g @catppuccin_pane_status_enabled "off"
set -g @catppuccin_pane_border_status "off"
set -g @plugin 'yh392261226/tmux-online-status'
# Configure Online
set -g @online_icon "ok"
set -g @offline_icon "nok"
set -g status-interval 5
# status left look and feel
set -g status-left-length 100
set -g status-left ""
set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_red},fg=#{@thm_bg},bold] #S },#{#[bg=#{@thm_bg},fg=#{@thm_green}] #S }}"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}] #{pane_current_command} "
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}] #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag, zoom ,}"
# status right look and feel
set -g status-right-length 100
set -g status-right ""
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_blue}]⇣ #{download_speed} / ⇡ #{upload_speed}"
set -ga status-right "#{?#{e|>=:10,#{battery_percentage}},#{#[bg=#{@thm_red},fg=#{@thm_bg}]},#{#[bg=#{@thm_bg},fg=#{@thm_pink}]}} #{battery_icon} #{battery_percentage} "
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
set -ga status-right "#[bg=#{@thm_bg}]#{?#{==:#{online_status},ok},#[fg=#{@thm_mauve}] on ,#[fg=#{@thm_red},bold]#[reverse] off }"
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│"
set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_blue}] %Y-%m-%d %H:%M "
# bootstrap tpm
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
bind-key i run-shell "~/.tmux/plugins/tpm/bin/install_plugins"
# Configure Tmux
set -g status-position top
set -g status-style "bg=#{@thm_bg}"
set -g status-justify "absolute-centre"
# pane border look and feel
setw -g pane-border-status top
setw -g pane-border-format ""
setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
setw -g pane-border-lines single
setw -g monitor-activity on # 非当前窗口有内容更新时在状态栏通知
# window look and feel
set -wg automatic-rename on
set -g automatic-rename-format "Window"
set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_rosewater}"
set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_peach}"
set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}"
set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]│"
set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_bg},bold"