AgentSkillsCN

setup-tmux

在任意机器或 IDE 终端上,按照 Melvyn 的配置快速搭建 tmux 环境。适用于设置 tmux、配置 tmux,或当用户提及 tmux 设置时使用。

SKILL.md
--- frontmatter
name: setup-tmux
description: "Setup tmux with Melvyn's config on any machine or IDE terminal. Use when setting up tmux, configuring tmux, or when user mentions tmux setup."
allowed-tools:
  - Bash
  - Read
  - Write

Setup Tmux

Install and configure tmux with a custom config: Ctrl+A prefix, mouse support, minimal status bar, TPM plugins (resurrect, continuum, yank), and intuitive keybindings.

Setup

Run the setup script:

bash
bash ~/.claude/skills/setup-tmux/scripts/setup-tmux.sh

The script handles everything automatically:

  1. Install tmux if missing (supports brew, apt, dnf, pacman)
  2. Backup existing ~/.tmux.conf
  3. Write the config
  4. Install TPM + plugins
  5. Reload config if tmux is running

IDE Integration

After running the setup script, configure the IDE terminal to use tmux:

VS Code / Cursor - Add to settings.json:

json
{
  "terminal.integrated.profiles.osx": {
    "tmux": {
      "path": "tmux",
      "args": ["new-session", "-A", "-s", "main"]
    }
  },
  "terminal.integrated.defaultProfile.osx": "tmux"
}

For Linux, replace osx with linux.

Zed - Add to settings.json:

json
{
  "terminal": {
    "shell": {
      "program": "tmux",
      "args": ["new-session", "-A", "-s", "main"]
    }
  }
}

Warp / iTerm2 / Alacritty / Kitty - Add to shell profile (~/.zshrc or ~/.bashrc):

bash
if command -v tmux &>/dev/null && [[ -z "$TMUX" ]]; then
  tmux new-session -A -s main
fi

Key Bindings Reference

ActionBinding
PrefixCtrl+A
Split horizontalPrefix + s
Split verticalPrefix + v
New windowPrefix + c
Kill panePrefix + w
Rename windowPrefix + r
Copy modePrefix + f
List all keysPrefix + h
Switch panesAlt + Arrow
Switch windowsShift + Arrow
DetachPrefix + d

Plugins

  • tmux-resurrect - Persist sessions across restarts
  • tmux-continuum - Auto-save/restore sessions
  • tmux-yank - System clipboard integration

Install plugins inside tmux: Prefix + I