Skip to content

StrangeRanger/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dotfiles

Project Tracker

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

What's Included

Features

Cross‑Platform Support

  • 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.

Automated Installation

  • 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/fonts and 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.

Automated Management

  • 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‑plug if it's missing and runs PlugInstallPlugUpdate, and TSUpdate in 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:unmodified comment at the bottom of the .zshrc file. This section ensures configurations can be added without them being tracked or overwritten during updates.

External Resource Management

  • Automated downloads: The .chezmoiexternal.toml.tmpl file tells chezmoi to fetch and cache third‑party tools during chezmoi apply. It downloads vim‑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.

Prerequisites

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)

Quick Start

  1. Install chezmoi (if not already installed):

    # macOS
    brew install chezmoi
    
    # Linux
    sh -c "$(curl -fsLS get.chezmoi.io)"
  2. Initialize with this repository:

    chezmoi init https://github.com/StrangeRanger/dotfiles.git
  3. Preview changes (optional):

    chezmoi diff
  4. 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.

Updating

To update your dotfiles:

chezmoi update

During 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 changes
  • s: Skip modifying ~/.zshrc (Default)
  • c: Abort the entire apply

Skip flag:

  • When skipping ~/.zshrc modifications, 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-zshrc or ~/.cache/chezmoi/skip-dot-zshrc. It is removed automatically on the next run.

Non-Interactive Behavior

Some steps are intentionally skipped when no TTY is available (e.g., in CI or automated provisioning) to avoid hanging on prompts:

  • .zshrc head drift
  • Package installation
  • Starship installation
  • Neovim installation

These safeguards ensure unattended runs complete safely without partial or unintended configuration changes.

Troubleshooting and Q&A

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_onchange state:
    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-plug is 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

Configuration Files

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.

Support and Issues

Please use GitHub Issues for bug reports and feature requests.

License

This project is licensed under the MIT License.

About

Personal configurations (dotfiles) tracked by chezmoi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published