| title | slug | date | enableToc |
|---|---|---|---|
htlin 的 dotfiles |
readme-zh-tw |
2023-02-16 |
false |
Dotfiles 是你個人化系統的方式,這是我的設定檔。
這是我個人的 macOS 開發環境設定檔,包含 Zsh、Neovim、tmux 以及各種現代化命令列工具的配置。
- Zsh 搭配 Oh-My-Zsh 與 Powerlevel10k 主題
- Neovim 編輯器配置
- tmux 終端多工管理
- Git 設定檔與實用別名
- 現代化命令列工具:fzf、ripgrep、fd、lsd、lazygit 等
- 自動化安裝:透過 bootstrap 腳本一鍵設定
- Homebrew 套件管理與 Brewfile
- macOS(已測試)或 Linux
- Git
- 網路連線
sudo -v && \
chsh -s /bin/zsh && \
touch ~/.hushloginHomebrew 是 macOS 缺少的套件管理工具。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 請依照指示將 Homebrew 加入 PATHgit clone https://github.com/htlin222/dotfiles.git ~/.dotfilesbrew bundle --file="~/.dotfiles/Brewfile"
brew cleanup --prune=all
rm -rf "$(brew --cache)"cd ~/.dotfiles/start
./link_dotfiles這會將設定檔以符號連結(symlink)的方式連結到你的家目錄。
# 安裝 Oh-My-Zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 安裝外掛
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/jeffreytse/zsh-vi-mode $ZSH_CUSTOM/plugins/zsh-vi-mode
git clone https://github.com/qoomon/zsh-lazyload $ZSH_CUSTOM/plugins/zsh-lazyload
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab| 類別 | 檔案 |
|---|---|
| Shell | .zshrc、.zshenv、.zprofile |
| Git | .gitconfig、.gitignore |
| tmux | .tmux.conf |
| Neovim | .config/nvim/ |
| R | .Rprofile |
如果 Homebrew 安裝的程式沒有出現在 /usr/local/bin:
sudo mkdir -p /usr/local/bin && \
sudo ln -s /opt/homebrew/bin/im-select /usr/local/bin/im-select && \
sudo ln -s /opt/homebrew/bin/nvim /usr/local/bin/nvim && \
sudo ln -s /opt/homebrew/bin/node /usr/local/bin/node# 尋找並安裝 Python 版本
pyenv install -l | grep 3\\.12\\.
pyenv install 3.12.0
# 為 Neovim 建立虛擬環境
pyenv virtualenv 3.12.0 neovim3
pyenv activate neovim3
pip install neovim pynvim
pyenv deactivate套用建議的 macOS 設定:
sh ~/.dotfiles/macos.shsudo xattr -r -d com.apple.quarantine /path/to/app.app如需完整的終端機開發工作流程指南,請參閱 docs 目錄,其中包含《終端人生》(The Terminal Way) 完整指南,涵蓋:
- Shell 設定與客製化
- tmux 終端多工管理
- Neovim 設定與使用
- 現代化命令列工具(fzf、ripgrep、fd 等)
- Git 工作流程優化
- 以及更多內容
使用風險自負。 此儲存庫包含我個人的設定檔與腳本。使用前請注意:
- 檢視程式碼 - 在執行任何腳本前,請先了解其功能
- 備份資料 - 這些腳本可能會覆蓋現有的設定檔
- 無保固 - 本軟體以「現狀」提供,不提供任何形式的保證
- 不負責任 - 對於使用這些 dotfiles 造成的任何損害或資料遺失,本人概不負責
- 先行測試 - 建議先在虛擬機器上測試,再套用到主系統
這些腳本包含的操作:
- 修改系統偏好設定
- 在家目錄建立或覆蓋符號連結
- 安裝軟體套件
- 變更 Shell 設定
在執行任何 bootstrap 腳本前,請務必備份現有的 dotfiles。
MIT 授權條款 - 詳細授權資訊請參閱各別檔案。
靈感來自社群中眾多 dotfiles 專案。特別感謝所有開源工具及其維護者。