Last active
September 11, 2025 12:58
-
-
Save JaHIY/8419cd0b5569643afbd51f900ff056e6 to your computer and use it in GitHub Desktop.
minimal tmux.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------- | |
# 基础设置 | |
# ---------------------------- | |
# 将重载配置的快捷键绑定为 prefix r[1](@ref) | |
bind r source-file ~/.tmux.conf \; display "Config Reloaded!" | |
# 设置终端支持256色[3,4](@ref) | |
set -g default-terminal "tmux-256color" | |
# ---------------------------- | |
# 快捷键前缀 (Prefix) | |
# ---------------------------- | |
# 设置前缀键为 Ctrl-a,并取消默认的 Ctrl-b 绑定[3,4](@ref) | |
unbind C-b | |
set -g prefix C-a | |
# 按下 Ctrl-a 两次后,会向终端发送真正的 Ctrl-a[3](@ref) | |
bind C-a send-prefix | |
# ---------------------------- | |
# 鼠标支持 | |
# ---------------------------- | |
# 启用鼠标支持,可用于切换面板、调整大小、选择窗口[1,4](@ref) | |
set -g mouse on | |
# ---------------------------- | |
# 窗口和面板设置 | |
# ---------------------------- | |
# 窗口编号从1开始(代替默认的0)[1](@ref) | |
set -g base-index 1 | |
# 面板编号从1开始(代替默认的0)[1](@ref) | |
set -g pane-base-index 1 | |
# 关闭窗口后,自动重新编号窗口以保持顺序[5](@ref) | |
set -g renumber-windows on | |
# ---------------------------- | |
# 历史记录和缓冲区 | |
# ---------------------------- | |
# 增加滚动回放的历史行数[2](@ref) | |
set -g history-limit 50000 | |
# 使用vi风格的键绑定进入复制模式[1,5](@ref) | |
setw -g mode-keys vi | |
# ---------------------------- | |
# 状态栏自定义 | |
# ---------------------------- | |
# 设置状态栏背景和前景色[3,5](@ref) | |
set -g status-style bg=colour235,fg=colour137 | |
# 设置状态栏左侧显示会话名称[5](@ref) | |
set -g status-left-length 40 | |
set -g status-left "#[fg=colour109] #S #[fg=colour246]| " | |
# 设置状态栏右侧显示日期时间[5](@ref) | |
set -g status-right "#[fg=colour246] | %Y-%m-%d %H:%M " | |
# 设置状态栏刷新间隔为60秒[5](@ref) | |
set -g status-interval 60 | |
# 设置窗口状态样式[5](@ref) | |
setw -g window-status-style fg=colour246 | |
setw -g window-status-current-style fg=white,bg=colour236 | |
# ---------------------------- | |
# 面板视觉区分 | |
# ---------------------------- | |
# 设置非活动面板的边框颜色更淡,以便与活动面板区分[5](@ref) | |
set -g pane-border-style fg=colour238 | |
set -g pane-active-border-style fg=colour109 | |
# ---------------------------- | |
# 杂项优化 | |
# ---------------------------- | |
# 减少各种Tmux消息的显示时间(毫秒)[1](@ref) | |
set -g display-time 3000 | |
# 按下Esc键后能更快地退出复制模式[5](@ref) | |
set -sg escape-time 10 | |
# ---------------------------- | |
# 面板(Pane)管理快捷键自定义 | |
# ---------------------------- | |
# 使用 | 和 - 进行分割,更直观 (同时保留原 % 和 " 绑定) | |
bind | split-window -h -c "#{pane_current_path}" # 垂直分割 (新面板保持当前路径) | |
bind - split-window -v -c "#{pane_current_path}" # 水平分割 (新面板保持当前路径) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment