dotfiles
| bootstrap.org | ||
| git.org | ||
| misc.org | ||
| neovim.org | ||
| psql.org | ||
| README.org | ||
| shell.org | ||
| tmux.org | ||
Dotfiles
这是我的 dotfiles, 使用 org mode 进行管理.
使用方式
新机器的初始化分为两步: 先生成引导脚本执行一次性安装任务, 再 tangle 日常配置文件.
第一步: 运行 bootstrap
bootstrap.org 用 org-mode noweb 将多个安装脚本组装成一个可执行文件. 在 Emacs 中:
(org-babel-tangle-file "~/code/dotfiles/bootstrap.org")
这会在 ~/.local/bin/bootstrap 生成脚本, 内容包含:
- 检测操作系统 (macOS / Linux)
- 安装 fish shell 和 fisher 插件
- 从 Dropbox 链接 SSH 密钥
- 安装 Homebrew 软件包 (仅 macOS)
- 链接 Emacs 配置文件
然后运行:
~/.local/bin/bootstrap
第二步: tangle 配置文件
在日常使用的 org 文件中执行 M-x org-babel-tangle 导出对应配置.
批量 tangle 全部文件:
(dolist (file (directory-files "~/code/dotfiles" t "\\.org$"))
(org-babel-tangle-file file))
配置索引
| 文件 | 内容 | 主要 tangle 目标 |
|---|---|---|
| bootstrap.org | 新机引导 (noweb 组装) | ~/.local/bin/bootstrap |
| shell.org | fish shell, starship, alias | ~/.config/fish/config.fish, starship.toml |
| git.org | gitconfig, ignore, message | ~/.gitconfig, ~/.gitignore_global |
| neovim.org | Neovim init.vim | ~/.config/nvim/init.vim |
| psql.org | pgcli + psqlrc | ~/.config/pgcli/config, ~/.psqlrc |
| tmux.org | tmux 配置 + 本地覆盖 | ~/.tmux.conf, ~/.tmux.conf.local |
| misc.org | bat, wtfutil, Xmodmap | ~/.config/bat/config, ~/.Xmodmap |
平台适配
部分配置根据操作系统选择性 tangle:
- macOS (
darwin): fish 的 Homebrew 路径 - Linux (
gnu/linux): asdf-vm 路径
使用 :tangle (if (eq system-type 'gnu/linux) "target" "no") 实现.