cmc/dotfiles

Using GNU Stow to manage my dotfiles. config dotfiles macos stow

Commit af4b92b972

af4b92b972bfcb8bd67d8132c953e6fbb1d02296

parent: ab794ba436

Unsigned

cmc <hello@cleberg.net> · 2026-02-08 17:52 UTC

format ZSH and update Git

Layout: unified · split

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