chezmoi
chezmoi 是一个跨平台的 dotfiles 管理工具,使用 Go 编写,支持模板、加密 secret、多机器差异配置。 安装¬ # Arch Linux pacman -S chezmoi # macOS brew install chezmoi # 通用安装脚本 sh -c "$(curl -fsLS get.chezmoi.io)" 初始化 # 初始化(本地,不关联远程仓库) chezmoi init # 初始化并关联远程 git 仓库(自动 clone 到 ~/.local/share/chezmoi/) chezmoi init git@github.com:用户名/仓库名.git # 用 GitHub 用户名简写(默认找 dotfiles 仓库) chezmoi init <github-username> chezmoi init 可以在任意目录执行,source 目录固定克隆到 ~/.local/share/chezmoi/,不需要手动指定位置。 添加文件 # 将文件纳入 chezmoi 管理 chezmoi add ~/.bashrc chezmoi add ~/.config/nvim/init.lua # 添加整个目录(递归) chezmoi add ~/.config/somedir # 添加时标记为模板 chezmoi add --template ~/.gitconfig 路径包含空格时加引号: ...