This repository was archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtmux.conf
116 lines (103 loc) · 5.15 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
##################################################################################################
# 全局选项
##################################################################################################
set -g set-titles off # 不更改terminal title
set -g default-terminal "xterm-256color" # 设置$TERM环境变量
set -g xterm-keys on # 支持xterm按键序列
set-option -g mouse on # 开启鼠标支持
setw -g mode-keys vi # 支持vi模式
set-option -s set-clipboard on # 开启系统剪切板支持
setw -g escape-time 50 # '<esc>'序列的延迟时间
set -g base-index 1 # 设置窗口的起始下标为1
set -g pane-base-index 1 # 设置面板的起始下标为1
set -g visual-activity on # 非当前窗口有内容更新时提醒用户
setw -g allow-rename off # 禁止运行的程序更名window
setw -g automatic-rename off # 禁止自动更名window
set-option -g status off # 不显示status line
set-option -sa terminal-overrides ",xterm-256color:Tc"
# set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides '*:Smulx=\E[4::%p1%dm,*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
##################################################################################################
# 状态栏配置
##################################################################################################
set -g status-interval 1 # 状态栏刷新时间
set -g status-justify left # 状态栏列表左对齐
set -g message-style "bg=#202529, fg=#91A8BA" # 指定消息通知的前景、后景色
set -g status-left "#[fg=cyan] #S \ue0b2" # 状态栏左侧内容
set -g status-right '#[fg=cyan]Continuum status: #{continuum_status}' # 状态栏右侧内容
set -g status-left-length 300 # 状态栏左边长度300
set -g status-right-length 500 # 状态栏右边长度500
set -wg window-status-format " #I #W " # 状态栏窗口名称格式
set -wg window-status-current-format " #I:#W#F #[fg=green]#[bg=black]\ue0b0" # 状态栏当前窗口名称格式(#I:序号,#w:窗口名称,#F:间隔符)
set -wg window-status-separator "" # 状态栏窗口名称之间的间隔
set -wg window-status-current-style "fg=white, bg=green" # 状态栏当前窗口名称的样式
set -wg window-status-last-style "fg=blue" # 状态栏最后一个窗口名称的样式
##################################################################################################
# 插件
##################################################################################################
# 保存会话插件
run-shell /usr/share/tmux-resurrect-git/resurrect.tmux
set -g @resurrect-dir '$HOME/.cache/tmux-resurrect'
##################################################################################################
# 快捷键
##################################################################################################
# 更改快捷键前缀
unbind C-Z
unbind C-B
set -g prefix M-w
# Window跳转
unbind 'b'
bind b previous-window
# Pane跳转
unbind-key M-Left
unbind-key M-Right
unbind-key M-Down
unbind-key M-Up
bind Up selectp -U
bind Down selectp -D
bind Left selectp -L
bind Right selectp -R
# Pane分割
unbind '%'
unbind '"'
bind s splitw -v -c '#{pane_current_path}'
bind v splitw -h -c '#{pane_current_path}'
# Pane大小调整
unbind-key C-Right
unbind-key C-Left
unbind-key C-Up
unbind-key C-Down
bind + resizep -U 10
bind - resizep -D 10
bind < resizep -L 10
bind > resizep -R 10
# 剪切板支持
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"
bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# 快速启动
bind h new-window htop
bind g new-window bashtop
bind i new-window "sudo iotop"
bind r new-window -c "#{pane_current_path}" ranger
bind m new-window "sleep 0.5;cmatrix"
bind f new-window -c "#{pane_current_path}" 'sed -n "/export FZF_DEFAULT_COMMAND=/,/fi$/p" ~/.zshrc > /tmp/fzf-ranger && bash /tmp/fzf-ranger && : > /tmp/fzf-ranger'
# 其他按键
## 切换statusline
unbind 't'
bind t set-option status
## 重载配置
unbind 'R'
bind R source-file ~/.tmux.conf \; display-message "Config reloaded.."
## 鼠标滚轮模拟
# Emulate scrolling by sending up and down keys if these commands are running in the pane
tmux_commands_with_legacy_scroll="nano less more man"
bind-key -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up Up Up" "copy-mode -et="'
bind-key -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down Down Down" "send -Mt="'