/
tmux.conf
94 lines (77 loc) · 3.11 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
############################ 选项 ############################
# 设置 ctrl-a 为 prefix
#unbind C-b
#set -g prefix C-a
# 设置 esc 键延迟
# !! 不要设置为 0,否则将导致 Alt 键的绑定功能随机失效
set -g escape-time 50
# 启动鼠标支持
set -g mouse on
# 使用 vi 模式按键
set -g mode-keys vi
# 设置窗口 id 从 1 开始计数
set -g base-index 1
# 设置最多历史回滚行数
set -g history-limit 20000
set -g xterm-keys on
# 禁止从头搜索
set -g wrap-search off
# 默认的 tmux/tmux-256color 对应用的兼容性不够
# 比如在 windows 下使用 msys2 下的 tmux 运行 windows 原生的 git log 命令
# 会收到此警告:WARNING: terminal is not fully functional
set -g default-terminal screen-256color
############################ 窗口 ############################
# 重新绑定下列按键不改变其功能只让当前目录作为新面板或新窗口的开始目录
bind-key '"' split-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
# Alt + C 创建新窗口
bind-key -n M-C new-window -c "#{pane_current_path}"
# Prefix + H/J 来分割窗口并使用当前目录作为新面板的开始目录
bind-key H split-window -c "#{pane_current_path}"
bind-key J split-window -h -c "#{pane_current_path}"
# Alt + H/J 来分割窗口并使用当前目录作为新面板的开始目录
bind-key -n M-H split-window -c "#{pane_current_path}"
bind-key -n M-J split-window -h -c "#{pane_current_path}"
# Alt + N/P 选择窗口
bind-key -n M-L select-window -l
bind-key -n M-N select-window -n
bind-key -n M-P select-window -p
# Alt + !/@/#...(Shift + 1/2/3...) 选择窗口
bind-key -n M-'!' select-window -t 1
bind-key -n M-'@' select-window -t 2
bind-key -n M-'#' select-window -t 3
bind-key -n M-'$' select-window -t 4
bind-key -n M-'%' select-window -t 5
bind-key -n M-'^' select-window -t 6
bind-key -n M-'&' select-window -t 7
bind-key -n M-'*' select-window -t 8
bind-key -n M-'(' select-window -t 9
bind-key -n M-')' select-window -t 10
############################ 面板 ############################
# Prefix + h/j/k/l 选择面板
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Prefix + b 同步当前窗口所有面板的输入
bind-key b set synchronize-panes
# Alt + h/j/k/l 选择面板
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
############################ 杂项 ############################
# 直接按 PageUp 也可进入 copy-mode
bind-key -n PageUp copy-mode -u
############################ 插件 ############################
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Other examples:
# 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 very bottom of tmux.conf)
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
run -b '~/.tmux/plugins/tpm/tpm'