时间轴

2025-10-20

init


tmux安装

1
2
3
4
sudo pacman -Sy tmux

# 启动
tmux

tmux配置

安装tpm

1
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

配置文件~/.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
# 设置前缀键为 Ctrl+q
unbind C-b
set -g prefix C-q
bind C-q send-prefix

# 关闭鼠标支持(可以鼠标点击切换面板/窗口)
set -g mouse off
# 让 tmux 正确转发扩展按键给 Emacs。
set -g xterm-keys on
set -g default-terminal "tmux-256color"
set -g renumber-windows on
set -g base-index 1 # 设置窗口的起始下标为1
set -g pane-base-index 1 # 设置面板的起始下标为1

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'


set -g @plugin 'catppuccin/tmux#v2.1.3'
set -g @catppuccin_flavor 'mocha'
# set -g @catppuccin_window_status_style "rounded"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_text "#W"
set -g @catppuccin_window_current_text "#W"

# Make the status line pretty and add some modules
set -g status-right-length 100
set -g status-left-length 100
set -g status-left ""

# set -g status-right "#{E:@catppuccin_status_session}"
set -g status-right "#{E:@catppuccin_status_uptime}"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

随后按C-q I下载包即可

常用快捷键

会话管理

命令/快捷键 说明
tmux new -s <name> 创建名为 name 的新会话
Ctrl+q d 分离当前会话(会话继续后台运行)
tmux ls 列出所有会话
tmux attach -t <name> 重新连接到指定会话
Ctrl+q $ 重命名当前会话
Ctrl+q s 切换会话

窗口管理

命令/快捷键 说明
Ctrl+q c 创建新窗口
Ctrl+q & 关闭当前窗口
Ctrl+q n 切换到下一个窗口
Ctrl+q p 切换到上一个窗口
Ctrl+q <number> 切换到指定编号的窗口
Ctrl+q , 重命名当前窗口

面板管理

命令/快捷键 说明
Ctrl+q % 垂直分割当前面板
Ctrl+q " 水平分割当前面板
Ctrl+q <arrow> 在面板间移动焦点
Ctrl+q x 关闭当前面板
Ctrl+q z 最大化/恢复当前面板
Ctrl+q Space 切换面板布局

history

在 tmux 中,“history 模式” 就是 copy-mode(复制模式),进入之后你就可以:

  • 用方向键滚动历史记录(箭头或C-p C-n)
  • 用鼠标滚轮滚动

按:
Ctrl + b [