-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.tmux.conf
More file actions
200 lines (163 loc) · 5.87 KB
/
.tmux.conf
File metadata and controls
200 lines (163 loc) · 5.87 KB
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
# Options
# 设置终端颜色
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
#set-option -g default-terminal "screen-256color"
# Enable RGB color if running in xterm
# 运行xterm时开启真色彩
set-option -g -a terminal-overrides ",xterm-256color:Tc"
# Set default prefix key
# 设定新的prefix键位
set-option -g prefix C-b
# Unbind default prefix key
# 解除默认prefix键设定
# unbind-key C-b
# Bind "C-a C-a" to send "C-a"
# 设定C-b C-b发送C-b
# bind-key C-b send-prefix
# 设定第二个 prefix
# set-option -g prefix2 Home
# Use vim key bindings
# 使用vim键位设定
set-option -g mode-keys vi
set-option -g status-keys vi
# Turn the mouse on
# 开启鼠标模式
set-option -g mouse on
# Time in milliseconds for which tmux waits after an escape
# tmux在转义后等待的时间(毫秒)
# set-option -g escape-time 0
# Enable supported focus events
# 启用焦点设定
set-option -g focus-events on
# 居中状态栏
set -g status-justify "left" # left,centre,right
# History settings
# 历史文件设定
set-option -g history-limit 10000
set-option -g history-file ~/.tmux/tmuxhistory
# Activity
# 开启活动通知
set-option -g monitor-activity on
set-option -g visual-activity off
# Start window index at 1
# 索引页以一为起始(window)
set-option -g base-index 1
# Start pane index at 1
# 索引页以一为起始(pane)
set-option -g pane-base-index 1
# Rename window to reflect current program
# 重命名窗口以反映当前程序
set-option -g -w automatic-rename on
# Renumber windows when one is closed
# 关闭windows时重新编号
set-option -g renumber-windows on
# No bells at all
# 全局无响铃设定
set-option -g bell-action none
# Reload configuration
# 重载tmux配置文件的快捷键
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# 映射 Alt + A 为 prefix + d
bind-key -n M-A detach-client
# 映射 Alt + S 为 prefix + &
bind-key -n M-S kill-window
# vim模式复制粘贴设定
bind-key v copy-mode # 绑定"v"键为进入复制模式
bind-key -T copy-mode-vi 'Escape' send -X cancel
bind-key -T copy-mode-vi 'v' send-keys -X rectangle-toggle \; send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# bind-key -T copy-mode-vi 'v' send -X begin-selection
# bind-key -T copy-mode-vi 'Space' send-keys -X rectangle-toggle
# Split window
# 分割窗口
bind-key | split-window -h
bind-key - split-window -v
# 调整窗口大小
# bind-key -n 'M-C-H' 'resize-pane -L 10'
# bind-key -n 'M-C-L' 'resize-pane -R 10'
# bind-key -n 'M-C-K' 'resize-pane -U 5'
# bind-key -n 'M-C-J' 'resize-pane -D 5'
bind-key -n ^I next-window
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|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
# Some extra key bindings to select higher numbered windows
#bind F1 selectw -t:10
#bind F2 selectw -t:11
#bind F3 selectw -t:12
#bind F4 selectw -t:13
#bind F5 selectw -t:14
#bind F6 selectw -t:15
#bind F7 selectw -t:16
#bind F8 selectw -t:17
#bind F9 selectw -t:18
#bind F10 selectw -t:19
#bind F11 selectw -t:20
#bind F12 selectw -t:21
# Change current pane to next window
#bind-key ! join-pane -h :1
#bind-key @ join-pane -h :2
#bind-key '#' join-pane -h :3
#bind-key '$' join-pane -h :4
#bind-key '%' join-pane -h :5
#bind-key '^' join-pane -h :6
#bind-key '&' join-pane -h :7
#bind-key '*' join-pane -h :8
#bind-key '(' join-pane -h :9
#bind-key ')' join-pane -h :10
# Some tweaks to the status line
# set -g status-right "%Y-%M-%d - %H:%M"
# set -g window-status-current-style "underscore"
# TPM设定
set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.tmux/plugins/'
# List of plugins
# 插件列表
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# 其他插件
set -g @plugin 'odedlaz/tmux-onedark-theme'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the ve
# 安装插件
run -b '$HOME/.tmux/plugins/tpm/tpm'
# 插件设定 Onedark
# set -g @onedark_widgets "#(date +%Y-%m-%d.%H:%M)"
set -g @onedark_time_format ""
set -g @onedark_date_format "%Y-%m-%d"
set -g @onedark_date_first true
# 插件设定 Highlight
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
# 插件设定 Yank
set -g @yank_selection 'clipboard'
# 插件设定 Continuum
set -g @continuum-boot 'on'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
set -g status-right 'Continuum status: #{continuum_status}'