This repository contains my dotfiles, managed with chezmoi. The goal of this repository is to provide a consistent and reproducible terminal environment across macOS and Linux systems by capturing shell settings, editor preferences, and much more.
Table of Contents
- Shell (Zsh): Platform‑specific configurations built on Oh My Zsh. The templates, located in .chezmoitemplates, define and source plugins, helper functions, and other settings.
- Shell Prompt: Custom Starship configurations, which define icons for many languages and OSes.
- Editor / IDE: Neovim configurations, with plugins managed by vim-plug.
- Version Control: A Git configuration template, with Delta integration.
- Fonts: Meslo Nerd Font files under .fonts to render terminal icons.
- Chezmoi Data & Templates: Data files and external resource definitions in .chezmoidata and .chezmoiexternal.toml.tmpl.
- Package Definitions: Package lists for different operating systems, used by the package installer script to install CLI tools.
- OS & package manager detection: The installer scripts check the OS and choose the appropriate package manager. Unsupported systems are skipped or fail gracefully.
- GUI awareness: A precompute script examines the environment and caches whether a GUI session is present. Other scripts use this flag to enable or disable desktop‑specific settings.
- Automatic template selection: When applying the Zsh configurations, the system automatically selects the appropriate template for Linux or macOS.
- Packages: The package installer script reads packages.yaml and installs both general and OS‑specific CLI tools via pacman, apt, or Homebrew. Refer to External Resource Management for additional software not handled by a package manager.
- Neovim & Starship: On Debian-based distros, dedicated scripts (Neovim & Starship) download the latest releases of Neovim and Starship from GitHub — package manager versions often lag behind. They compare these with the currently installed versions and install them if they're newer. On macOS and Arch, these tools are managed by a package manager.
- Nerd fonts: A font installer script checks whether Meslo Nerd Font files are missing or outdated by comparing file hashes, then copies updated fonts into
~/.local/share/fontsand refreshes the font cache. macOS users get their fonts via a Homebrew cask. - Default shell: A default shell script sets Zsh as the default shell for the current user. This script only runs once, unless executed manually.
- Neovim plugin maintenance: A plugin‑update script runs whenever your Neovim configurations change or after a set amount of time has passed. It installs
vim‑plugif it's missing and runsPlugInstall,PlugUpdate, andTSUpdatein headless mode to install and update plugins and tree-sitters. - Safe shell updates: Before overwriting your Zsh configurations, a drift‑detection script extracts the managed portion of
~/.zshrc, compares it with the current template, shows a diff, and prompts you to apply, skip, or cancel the changes.- Managed portion: The drift-detection script ignores all changes below the
chezmoi:unmodifiedcomment at the bottom of the.zshrcfile. This section ensures configurations can be added without them being tracked or overwritten during updates.
- Managed portion: The drift-detection script ignores all changes below the
- Automated downloads: The .chezmoiexternal.toml.tmpl file tells chezmoi to fetch and cache third‑party tools during
chezmoi apply. It downloadsvim‑plug, Oh My Zsh, zsh plugins, and much more. - Scheduled refreshes: Each external resource defines a refresh period of 168 hours (one week), ensuring that these tools stay up to date without manual intervention.
These dotfiles are made for macOS and Linux only. Before applying them, ensure you meet the following prerequisites:
- chezmoi for dotfiles management
- Homebrew (on macOS)
- Git (version 2.0+)
- Bash (version 3.2+)
- Internet connection for downloading external resources
- Administrative privileges (for package installation on Linux)
-
Install chezmoi (if not already installed):
# macOS brew install chezmoi # Linux sh -c "$(curl -fsLS get.chezmoi.io)"
-
Initialize with this repository:
chezmoi init https://github.com/StrangeRanger/dotfiles.git
-
Preview changes (optional):
chezmoi diff
-
Apply the dotfiles:
chezmoi apply
[!NOTE] The first run will install packages, fonts and configure your environment. This may take a minute or two and will require administrative privileges on Linux systems.
To update your dotfiles:
chezmoi updateDuring the update/apply process, you may see a prompt like:
Detected changes in '~/.zshrc' above '#### chezmoi:unmodified'.
--- current (head) vs rendered (head) diff ---
<colorized diff>
Proceed with changes? [y]es / [S]kip / [c]ancel apply:
Options:
y: Apply the changess: Skip modifying~/.zshrc(Default)c: Abort the entire apply
Skip flag:
- When skipping
~/.zshrcmodifications, a skip flag file is created so the modifying template leaves it as-is. - The flag is placed at
$XDG_RUNTIME_DIR/chezmoi/skip-dot-zshrcor~/.cache/chezmoi/skip-dot-zshrc. It is removed automatically on the next run.
Some steps are intentionally skipped when no TTY is available (e.g., in CI or automated provisioning) to avoid hanging on prompts:
.zshrchead drift- Package installation
- Starship installation
- Neovim installation
These safeguards ensure unattended runs complete safely without partial or unintended configuration changes.
Permission denied during package installation
# Make sure you have sudo privileges on Linux. sudo -v
Package installation being skipped
- Non-interactive environments (like CI) skip package installation by default.
- Chezmoi attempts to install packages only once, until the installer script or the packages list changes.
- If you need to rerun the installer again, you can clear chezmoi's
run_onchangestate:chezmoi state delete-bucket --bucket=entryState chezmoi apply
Fonts not appearing correctly
- Ensure your terminal supports Nerd Fonts.
- Reinitialize font cache with
fc-cache -fv.- Restart your terminal after font installation.
Neovim plugins not loading
- Make sure
vim-plugis installed.- Manually install/update plugins:
nvim +PlugInstall +PlugUpdate +qall
Neovim installation issues on Linux
- Neovim only supports x86_64 and arm64 architectures.
- Ensure you have administrative privileges for installation.
- Check that curl is available for downloading the latest release.
Starship prompt not showing
- Verify Starship is installed:
starship --version- Check if Starship is initialized in your shell config.
Neovim plugins not updating automatically
- The system automatically updates plugins every 7 days or when Neovim configs change.
- To force an update:
nvim +PlugInstall +PlugUpdate +qall
| File/Directory | Purpose |
|---|---|
.chezmoidata/packages.yaml |
Package definitions for automatic installation across platforms (general and OS‑specific packages). |
.chezmoiexternal.toml.tmpl |
Defines third‑party resources for Chezmoi to fetch, such as vim‑plug, Copilot Vim, Oh My Zsh, zsh plugins and a prebuilt fzf binary, with refresh schedules. |
.chezmoiignore |
Lists files to exclude from chezmoi management. |
.chezmoitemplates/zshrc_darwin.tmpl and zshrc_linux.tmpl |
OS‑specific Zsh templates defining environment variables, aliases and helper functions. |
private_dot_config/starship.toml |
Starship prompt configuration, including Nerd‑Font icons and module settings. |
private_dot_config/nvim/ |
Neovim configuration directory (init.vim, second_init.lua) with plugin management. |
dot_gitconfig.tmpl |
Global Git configuration with Delta integration for enhanced diffs. |
modify_dot_zshrc |
Template that merges the managed head of ~/.zshrc with the unmodified tail. |
run_before_02_zshrc_drift_detection.bash |
Pre‑apply hook that detects drift in ~/.zshrc above the #### chezmoi:unmodified marker, shows a diff, and prompts to apply, skip or cancel. |
run_before_01_precompute.bash.tmpl |
Precompute script executed before apply; checks for supported OS, detects git‑delta and whether a GUI session is present, then writes results to .precomputed_data.json. |
run_after_update_nvim_plugins.bash |
Installs vim‑plug if missing and updates Neovim plugins and tree‑sitter parsers when configs change or after a set interval. |
run_onchange_install_packages.bash.tmpl |
Script that reads packages.yaml and installs general and OS‑specific CLI tools via pacman, apt, or Homebrew. |
run_onchange_install_fonts.bash |
Checks for missing or outdated Meslo Nerd Font files on Linux, installs them, and refreshes the font cache; skipped on macOS. |
run_install_neovim.bash |
Installs the latest Neovim release on Debian‑based distributions when the package manager version lags behind. |
run_install_starship.bash |
Installs the latest Starship release on Debian‑based distributions, skipping macOS and Arch. |
run_once_set_default_shell.bash |
One‑time script that sets Zsh as the default shell for the current user, ensuring it’s listed in /etc/shells. |
Please use GitHub Issues for bug reports and feature requests.
This project is licensed under the MIT License.