tmux命令及配置备忘

.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
set -g mouse on

# 在不同面板间切换,改为vim风格
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R


# set prefix to Ctrl A
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix


# Prefix and Ctrl N to new window
bind -n C-n new-window
# Prefix and Ctrl W to close window
bind -n C-w kill-pane

# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window

# Set easier window split keys prefix first
bind-key v split-window -h
bind-key h split-window -v

# Easy config reload prefix first
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"

# 绑定快捷键 Alt+O,在当前窗口中切换不同的面板布局(平铺、堆叠等)
bind -n C-l next-layout

# B 将当前面板拆分为一个新的窗口
bind B break-pane

常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# new session
tmux new -s mysession

# attach to a session with name
tmux a -t mysession

# attach to last session
tmux a

# show all session
tmux ls

# kill all session
tmux kill-session -a

窗口

1
2
3
C-n #新建窗口
C-a + , # 重命名窗口
S-Left / S-Right #q