cmc/dotfiles

Using GNU Stow to manage my dotfiles.

clone: git clone https://gitbay.org/cmc/dotfiles.git

af4b92b972bfcb8bd67d8132c953e6fbb1d02296

unsigned

author: Christian Cleberg <hello@cleberg.net> · 2026-02-08T17:52:31Z

format ZSH and update Git
 bootstrap.sh          |  42 ++++++++++++++++-----
 git/.gitconfig        |   1 +
 git/.gitignore_global |  29 ++++++++++++++
 zsh/.zshrc            | 102 ++++++++++++++++++++++++++++++++------------------
 4 files changed, 128 insertions(+), 46 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh
index 2f5050b..23c8145 100644
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -2,34 +2,56 @@
 
 # Define colors for output
 GREEN='\033[0;32m'
+BLUE='\033[0;34m'
 RED='\033[0;31m'
 NC='\033[0m' # No Color
 
-echo "Starting dotfiles bootstrap..."
+echo -e "${BLUE} Starting dotfiles bootstrap...${NC}"
 
-# 1. Check if GNU Stow is installed
-if ! command -v stow &> /dev/null; then
-    echo -e "${RED}Error: GNU Stow is not installed.${NC}"
-    echo "Please install it via your package manager (brew install stow / apt install stow)."
-    exit 1
+# 1. Check for Homebrew
+if ! command -v brew &> /dev/null; then
+    echo "Installing Homebrew..."
+    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+else
+    echo -e "${GREEN}✓ Homebrew is already installed${NC}"
 fi
 
-# 2. Get the directory where this script is located
+# 2. Install Dependencies
+echo "Checking dependencies..."
+DEPENDENCIES=(
+    stow
+    zsh-autosuggestions
+    zsh-syntax-highlighting
+    romkatv/powerlevel10k/powerlevel10k
+)
+
+for dep in "${DEPENDENCIES[@]}"; do
+    if brew list "$dep" &>/dev/null || brew list --cask "$dep" &>/dev/null; then
+        echo -e "${GREEN}✓ $dep is already installed${NC}"
+    else
+        echo "Installing $dep..."
+        brew install "$dep"
+    fi
+done
+
+# 3. Get the directory where this script is located
 DOTFILES_DIR=$(dirname "$(realpath "$0")")
 cd "$DOTFILES_DIR"
 
-# 3. Define packages based on your folder structure
+# 4. Define packages based on your folder structure
 PACKAGES=(doom git ispell skhd yabai zsh)
 
-echo "Symlinking packages..."
+echo -e "${BLUE} Symlinking packages with GNU Stow...${NC}"
 
 for pkg in "${PACKAGES[@]}"; do
     if [ -d "$pkg" ]; then
         echo -e "Stowing: ${GREEN}$pkg${NC}"
+        # -R (restow) is safer as it prunes dead links and updates new ones
         stow -R "$pkg"
     else
         echo -e "${RED}Warning: Package directory '$pkg' not found. Skipping.${NC}"
     fi
 done
 
-echo -e "${GREEN}Done! Your dotfiles are now stowed.${NC}"
+echo -e "${GREEN} Done! Your environment is ready.${NC}"
+echo "Note: You may need to restart your terminal or run 'source ~/.zshrc'"
diff --git a/git/.gitconfig b/git/.gitconfig
index 2792bce..ea494ad 100644
--- a/git/.gitconfig
+++ b/git/.gitconfig
@@ -4,6 +4,7 @@
 	email = hello@cleberg.net
 	signingkey = hello@cleberg.net
 [core]
+	excludesfile = ~/.gitignore_global
 	editor = emacs
 	autocrlf = input
 	untrackedCache = true
diff --git a/git/.gitignore_global b/git/.gitignore_global
new file mode 100644
index 0000000..5abac3e
--- /dev/null
+++ b/git/.gitignore_global
@@ -0,0 +1,29 @@
+# macOS
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Editors
+*.swp
+*.swo
+*~
+.vscode/
+.idea/
+
+# Common logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 23926eb..1019bba 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -1,53 +1,83 @@
-echo 'export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH' >> ~/.zshrc
-
-# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
-# Initialization code that may require console input (password prompts, [y/n]
-# confirmations, etc.) must go above this block; everything else may go below.
+# ==============================================================================
+# 1. PRE-INITIALIZATION (Instant Prompt)
+# ==============================================================================
 if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
   source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
 fi
 
-export NVM_DIR="$HOME/.nvm"
-[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
-[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion
-
+# ==============================================================================
+# 2. ENVIRONMENT VARIABLES & PATH
+# ==============================================================================
+export PATH="/Users/cmc/.local/xonsh-env/xbin:$PATH"
 export GPG_TTY=$(tty)
 
-alias l="ls -lha"
-alias emacs="emacs -nw"
+# NVM Configuration
+export NVM_DIR="$HOME/.nvm"
+[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
+[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
 
-# Lines configured by zsh-newuser-install
+# History Settings
 HISTFILE=~/.histfile
 HISTSIZE=1000
 SAVEHIST=1000
+
+# ==============================================================================
+# 3. COMPLETION & UI SETTINGS
+# ==============================================================================
 bindkey -e
-# End of lines configured by zsh-newuser-install
-# The following lines were added by compinstall
 zstyle :compinstall filename '/Users/cmc/.zshrc'
+autoload -Uz compinit && compinit
 
-autoload -Uz compinit
-compinit
-# End of lines added by compinstall
+# Load Theme
 source /opt/homebrew/share/powerlevel10k/powerlevel10k.zsh-theme
-
-# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
 [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
 
+# ==============================================================================
+# 4. ALIASES
+# ==============================================================================
+alias l="ls -lha"
+alias emacs="emacs -nw"
+alias xclean="find . -name '.DS_Store' -type f -delete"
+
+# Git
+alias g='git'
+alias gs='git status'
+alias ga='git add'
+alias gaa='git add --all'
+alias gc='git commit -v'
+alias gcm='git commit -m'
+alias gca='git commit --amend --no-edit'
+alias gb='git branch'
+alias gco='git checkout'
+alias gcob='git checkout -b'
+alias gma='git checkout main'
+
+# ==============================================================================
+# 5. PLUGINS (Must be loaded after aliases for best results)
+# ==============================================================================
 source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
-export PATH=/Users/cmc/.local/xonsh-env/xbin:$PATH
+
+# Syntax Highlighting MUST be the last thing sourced
+source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+
+# ==============================================================================
+# 6. SYNTAX HIGHLIGHTING CUSTOMIZATION
+# ==============================================================================
+# Must be defined AFTER the plugin is sourced
+# Colors available: black, red, green, yellow, blue, magenta, cyan, white
+# Styles: bold, underline
+
+# Highlight aliases in Cyan
+ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan,bold'
+
+# Highlight standard commands in Green
+ZSH_HIGHLIGHT_STYLES[command]='fg=green'
+
+# Highlight built-ins (like cd, echo) in Magenta
+ZSH_HIGHLIGHT_STYLES[builtin]='fg=magenta'
+
+# Highlight valid paths in White with an underline
+ZSH_HIGHLIGHT_STYLES[path]='fg=white,underline'
+
+# Highlight errors (typos) in Red
+ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold'