Files
.dotfile/script/tmux-init.sh
T
laily 67291a9a50 feat: add script catalog and -h help for all dotfile scripts
Introduce ff script -h with auto descriptions, shared help.sh, and usage flags across script/*.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:09:35 +08:00

42 lines
892 B
Bash
Executable File

#!/bin/bash
# 链接 tmux 配置并安装 TPM 插件
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/common/help.sh"
usage() {
cat <<'EOF'
用法: tmux-init
1. 将 ~/.tmux.conf 链接到 ~/.dotfile/tmux/.tmux.conf
2. 克隆 tpm 到 ~/.tmux/plugins/tpm(若不存在)
3. 安装插件并 reload tmux 配置
选项:
-h, --help 显示此帮助
EOF
}
dotfile_help_requested "${1:-}" && dotfile_show_help
set -euo pipefail
echo 'Init tmux config'
src=$HOME/.tmux.conf
if [ -e "$src" ]; then
mv "$src" "$src.bak"
fi
ln -s "$HOME/.dotfile/tmux/.tmux.conf" "$src"
echo 'Install tpm'
if [ ! -e ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
echo 'Install tmux plugin by tpm'
"$HOME/.tmux/plugins/tpm/bin/install_plugins"
echo 'Reload tmux'
tmux source ~/.tmux.conf