效果展示

配置文件
# -----------------------------------------------------------------------------
# 基础设置
# -----------------------------------------------------------------------------
# 将 prefix 键从 C-b 更改为 C-a,更方便操作
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# 设置默认的终端为 xterm-256color,以支持更丰富的颜色
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",tmux-256color:Tc" # 启用真正的颜色 (true color)
# 开启鼠标支持
set -g mouse on
# 更快地切换窗口 (使用 alt + 数字键)
bind -n M-0 select-window -t :0
bind -n M-1 select-window -t :1
bind -n M-2 select-window -t :2
bind -n M-3 select-window -t :3
bind -n M-4 select-window -t :4
bind -n M-5 select-window -t :5
bind -n M-6 select-window -t :6
bind -n M-7 select-window -t :7
bind -n M-8 select-window -t :8
bind -n M-9 select-window -t :9
# 重新加载配置文件
bind r source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded!"
# -----------------------------------------------------------------------------
# 窗口和面板操作
# -----------------------------------------------------------------------------
# 垂直分割面板
bind | split-window -h
# 水平分割面板
bind - split-window -v
# 使用 hjkl 切换面板 (与 Vim 风格一致)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# 调整面板大小 (按住 prefix 并使用 HJKL)
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# 关闭当前面板
bind x kill-pane #-confirm
# 关闭当前窗口
bind & kill-window #-confirm
# -----------------------------------------------------------------------------
# 状态栏设置
# -----------------------------------------------------------------------------
# 设置状态栏位置 (顶部或底部)
set -g status-position bottom
# 设置状态栏颜色
set -g status-bg colour235
set -g status-fg white
# 设置窗口列表的样式
setw -g window-status-format " #I:#W#F "
setw -g window-status-current-format " #I:#W#F* "
#setw -g window-status-bg colour238
#setw -g window-status-current-bg colour31
#setw -g window-status-fg colour86
#setw -g window-status-current-fg colour15
# 设置左右两侧状态栏的样式
set -g status-left "#[fg=colour197,bg=colour238] #h #[fg=colour238,bg=colour235,bold]"
set -g status-right "#[fg=colour233,bg=colour235,bold]#[fg=colour255,bg=colour233] %Y-%m-%d %A #[fg=colour197,bg=colour233,bold]#[fg=colour235,bg=colour197] %H:%M:%S "
# 设置状态栏的刷新间隔 (秒)
set -g status-interval 1
# -----------------------------------------------------------------------------
# 插件管理 (使用 tpm)
# -----------------------------------------------------------------------------
# 安装 tpm (Tmux Plugin Manager) 的说明:
# 1. 确保你已经安装了 git
# 2. 运行以下命令:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# 设置 tpm 的路径
set -g @plugin 'tmux-plugins/tpm'
# 列出你想要安装的插件
# 插件格式为 'github_username/repository_name'
set -g @plugin 'tmux-plugins/tmux-sensible' # 提供一些常用的默认设置
#set -g @plugin 'tmux-plugins/tmux-resurrect' # 保存和恢复 tmux 会话
#set -g @plugin 'tmux-plugins/tmux-continuum' # 开机自动保存 tmux 会话
set -g @plugin 'christoomey/vim-tmux-navigator' # 在 Vim 和 tmux 面板之间无缝切换 (需要安装 Vim)
#set -g @plugin 'tmux-plugins/tmux-yank' # 方便复制 tmux 中的文本到系统剪贴板
#set -g @plugin 'tmux-plugins/tmux-prefix-highlight' # 在按下 prefix 键时高亮状态栏
# 其他有用的插件 (你可以根据自己的需求选择)
# set -g @plugin 'wfxr/tmux-fzf' # 使用 fzf 模糊搜索窗口和会话
# set -g @plugin 'thewtex/tmux-mem-cpu-load' # 在状态栏显示 CPU 和内存使用情况
# set -g @plugin 'samoshkin/tmux-plugin-sysstat' # 在状态栏显示更多系统信息
# set -g @plugin 'niksingh7/tmux-spotify' # 在状态栏显示 Spotify 播放状态
# set -g @plugin 'tmux-plugins/tmux-battery' # 在状态栏显示电池状态
# 重要: 最后一行需要保持这样,用于初始化 tpm
run '~/.tmux/plugins/tpm/tpm'
# -----------------------------------------------------------------------------
# 使用说明
# -----------------------------------------------------------------------------
# 在 tmux 会话中,按下 prefix (默认为 C-a) 之后可以使用的常用命令:
# ? : 列出所有快捷键
# r : 重新加载配置文件
# s : 选择会话
# w : 选择窗口
# c : 创建新窗口
# n : 切换到下一个窗口
# p : 切换到上一个窗口
# 数字键 : 切换到对应的窗口 (如果设置了 base-index 1,则使用 1-9)
# | : 垂直分割面板
# - : 水平分割面板
# h/j/k/l: 切换面板 (需要配置)
# x : 关闭当前面板
# & : 关闭当前窗口
# prefix + Space: 切换面板布局
#
# 使用 tpm (在 tmux 会话中):
# prefix + I (大写 i) : 安装配置文件中列出的插件
# prefix + U (大写 u) : 更新所有插件
# prefix + shift + r : 卸载未在配置文件中列出的插件
# -----------------------------------------------------------------------------
# 个性化建议 (针对音乐制作)
# -----------------------------------------------------------------------------
# 如果你经常在 tmux 中进行音乐制作相关的工作,可以考虑以下配置:
# 专门为音频相关的任务创建窗口和面板,例如:
# - 一个窗口用于运行 DAW (Digital Audio Workstation)
# - 一个窗口用于运行终端命令,例如 Jack 音频服务器的管理
# - 一个窗口用于查看音频文件的信息或进行简单的音频处理
# 你可以自定义快捷键来快速切换到这些特定的窗口:
bind -n M-w select-window -t :1 # 例如,Alt+w 切换到 DAW 窗口
bind -n M-t select-window -t :2 # 例如,Alt+t 切换到终端窗口
# 考虑使用 tmux-yank 插件方便地复制 DAW 或终端中的信息。
# 如果你需要监控系统音频相关的进程,tmux-mem-cpu-load 或 tmux-plugin-sysstat 可能会很有用。
#run 'tmux new-window "cat /etc/motd"'