-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdot_tmux.conf
246 lines (204 loc) · 6.67 KB
/
dot_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
# -----------------
# Tmux 自定义配置
# -----------------
#+---------+
#+ options +
#+---------+
# 修改 Prefix 组合键为 ctrl + s
set -g prefix C-s
unbind C-b
bind C-s send-prefix
# 设置延时
set -sg escape-time 1 # 修改默认延时,设置为1ms,增加响应
# 开启鼠标模式
set -g mouse on
# 关闭自动改名
set-option -g allow-rename off
# 开启剪贴板
set -g set-clipboard on
# buffer 长度
set -g history-limit 50000
# 加载 tmux 配置文件的快捷键: prefix r
bind r source-file ~/.tmux.conf\; display "Reloaded!"
set-option -g focus-events on
#+------+
#+ pane +
#+------+
# 设备面板索引
setw -g pane-base-index 1
# 选择面板快捷键
bind h select-pane -L # 左
bind j select-pane -D # 下
bind k select-pane -U # 上
bind l select-pane -R # 右
# 调节面板大小快捷键
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
# 面板边缘显示
set -g pane-border-status top
#+--------+
#+ window +
#+--------+
# 设置窗口索引
set -g base-index 1
# 选择窗口快捷键
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# 修改默认的分割 window 快捷键
bind | split-window -h
bind - split-window -v
#+-----------+
#+ copy-mode +
#+-----------+
# 开启 vi 按键
setw -g mode-keys vi
set -g status-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T vi-edit Up send -X history-up
bind-key -T vi-edit Down send -X history-down
#+----------+
#+ status +
#+----------+
# 状态栏刷新间隔
set -g status-interval 1
# 状态栏窗口居中
set -g status-justify centre
# 左/右侧状态栏长度
set-option -g status-left-length "80"
set-option -g status-right-length "80"
# 开启活动通知
setw -g monitor-activity on
set -g visual-activity off
#+--------------+
#+ color scheme +
#+--------------+
# 以 256 色显示内容
set -g default-terminal "tmux-256color"
set -sa terminal-features ',*256col*:RGB'
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"
# # COLORSCHEMA: gruvbox dark (medium)
# set-option -g status "on"
#
# # default statusbar color
# set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
#
# # default window title colors
# set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1
#
# # default window with an activity alert
# set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
#
# # active window title colors
# set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
#
# # pane border
# set-option -g pane-active-border-style fg=colour250 #fg2
# set-option -g pane-border-style fg=colour237 #bg1
#
# # message infos
# set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
#
# # writing commands inactive
# set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=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 bg=colour167,fg=colour235 # bg=red, fg=bg
#
# set-option -g status-left "#[bg=colour241,fg=colour248] #S "
# set-option -g status-right "#{prefix_highlight}#[bg=colour239,fg=colour246] %Y-%m-%d | %H:%M #[bg=colour248,fg=colour237] #h "
#
# set-window-option -g window-status-current-format "#[bg=colour214,fg=colour239] #I #[bg=colour214,fg=colour239,bold]#W#{?window_zoomed_flag,*Z,} "
# set-window-option -g window-status-format "#[bg=colour239,fg=colour223] #I #[bg=colour239,fg=colour223]#W "
#
# set-window-option -g window-status-separator " "
#+--------+
#+ plugin +
#+--------+
# tmp 插件管理
# 快捷键:
# install: prefix + shift + i
# update: prefix + shift + u
set -g @plugin 'tmux-plugins/tpm'
# 日志记录
# 快捷键:
# logging: prefix + shift + p
# screen capture: prefix + alt + p
# save complete history: prefix + shift + alt + p
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @logging-path "$HOME/.tmux/logs"
set -g @logging-filename "tmux-#{session_name}-#{window_name}-#{pane_index}-%Y%m%dT%H%M%S.log"
# tmux 会话备份和恢复
# 快捷键:
# prefix + Ctrl-s - save
# prefix + Ctrl-r - restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on' # 开启恢复面板内容功能
# 自动备份和恢复
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-save-interval '1440'
set -g @continuum-restore 'on'
# 系统剪贴板
# 快捷键:
# normal mode:
# - prefix + y: copies text from the command line to the clipboard
# - prefix + shift + y: copy the current pane's current working directory to the clipboard
# copy mode:
# - y: copy selection to system clipboard
# - Y: "put" selection. Equivalent to copying a selection, and pasting it to the command line
set -g @plugin 'tmux-plugins/tmux-yank'
# 复制后不退出 copy-mode
set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default
# prefix 高亮
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
# 适配 gruvbox colorscheme
set -g @prefix_highlight_copy_mode_attr "fg=color239,bg=color214,bold"
# quickly select, copy/insert/complete text without a mouse
# require fzf
# 快捷键:
# - prefix + tab: Key to start
# - extrakto:
# - tab: Key to insert selection
# - enter: Key to copy selection to clipboard
# - ctrl + e: Key to run the editor
# - ctrl + o: Key to run the open command
set -g @plugin 'laktak/extrakto'
# tmux-fzf: use fzf to manage tmux environment
# 快捷键:
# - prefix + F: Key to start
set -g @plugin 'sainnhe/tmux-fzf'
# tmux-thumbs
set -g @plugin 'fcsonline/tmux-thumbs'
run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux
# catppuccin colorscheme
set -g @plugin 'catppuccin/tmux'
run-shell '~/.tmux/plugins/tmux/catppuccin.tmux'
# catppuccin config
# > theme
set -g @catppuccin_flavor 'mocha' # latte,frappe, macchiato or mocha
# > window
set -g @catppuccin_window_status_style "rounded"
# > status
set -g status-right-length 100
set -g status-left-length 100
set -g status-left ""
set -g status-right "#{E:@catppuccin_status_application}"
set -agF status-right "#{E:@catppuccin_status_cpu}"
set -ag status-right "#{E:@catppuccin_status_session}"
set -ag status-right "#{E:@catppuccin_status_uptime}"
# tmux-cpu
set -g @plugin 'tmux-plugins/tmux-cpu'
# 初始化 tpm
run '~/.tmux/plugins/tpm/tpm'