Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# dotfiles

My personal dotfiles. macOS primary, Linux compatible.

## What's included

| Tool | Config | Notes |
|------|--------|-------|
| **zsh** | `zsh/` | Prompt with git info, history, aliases, functions |
| **git** | `git/` | Modern defaults, useful aliases, pretty log |
| **tmux** | `tmux/` | C-a prefix, vim-style nav, Tokyo Night theme, TPM |
| **Ghostty** | `config/ghostty/` | Tokyo Night, Monaspace font, transparency |

## Bootstrap

Install tools first, then link dotfiles:

```bash
git clone https://github.com/davidstosik/dotfiles ~/.dotfiles
cd ~/.dotfiles

# 1. Install packages (neovim, gh, tmux, mise, ripgrep, fzf)
./mitamae/bootstrap.sh

# 2. Link dotfiles
./install.sh
```

`mitamae/bootstrap.sh` downloads the [mitamae](https://github.com/itamae-kitchen/mitamae) binary for your platform and runs the recipe. mitamae's `package` resource auto-detects the package manager (Homebrew on macOS, apt on Linux), so the same recipe works everywhere.

## Post-install

1. **Restart your shell** (or `source ~/.zshrc`)
2. **tmux:** Press `C-a I` to install tmux plugins via TPM

## Local overrides

Machine-specific config goes in local files (not tracked by git):

- **`~/.zshrc.local`** — extra shell config, env vars, work-specific paths
- **`~/.gitconfig.local`** — work email, signing keys, conditional includes

Example `~/.gitconfig.local`:

```gitconfig
[user]
email = david@work.com

[includeIf "gitdir:~/work/"]
path = ~/work.gitconfig
```

## Structure

```
dotfiles/
├── install.sh # Symlink installer
├── README.md
├── mitamae/
│ ├── bootstrap.sh # Download mitamae + run recipe
│ └── recipe.rb # Package installation recipe
├── zsh/
│ ├── zshrc # Main shell config
│ ├── aliases.zsh # Aliases (git, navigation, safety, ruby)
│ └── functions.zsh # Shell functions (mkcd, vpn-fix)
├── git/
│ ├── gitconfig # Git configuration
│ └── gitignore # Global gitignore
├── tmux/
│ ├── tmux.conf # tmux configuration
│ └── tmux.mac.conf # macOS-specific (pbcopy integration)
└── config/
└── ghostty/
└── config # Ghostty terminal config
```

## Design decisions

- **mitamae for package installation** — single static binary (mruby compiled in), no Ruby/RubyGems needed. Chef-like DSL with `package` resource that auto-detects the package manager. One recipe works on macOS (Homebrew) and Linux (apt). Cross-platform from day one.
- **install.sh for symlinking** — plain symlinks, idempotent, zero dependencies beyond git and zsh. mitamae handles packages, install.sh handles links — clean separation of concerns.
- **No dotfiles framework** — chezmoi, yadm, etc. are overkill for this setup. mitamae + install.sh covers packages and links with minimal complexity.
- **mise over rbenv/nvm** — single tool for all language versions.
- **Local override files** — machine-specific config stays out of the repo.
- **macOS + Linux** — platform conditionals where needed (ls colors, vpn-fix, tmux copy).
2 changes: 0 additions & 2 deletions ghostty.config → config/ghostty/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ font-feature = ss08
font-feature = ss09
font-variation = wght=300

# fi fl

window-inherit-font-size = false
font-size = 13

Expand Down
46 changes: 37 additions & 9 deletions gitconfig → git/gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,52 @@
defaultBranch = main

[alias]
addp = add --patch
# Shortcuts
co = checkout
cob = checkout -b
ci = commit --verbose
cim = commit --verbose --message
cia = commit --amend --no-edit
ciam = commit --amend
cim = commit --verbose --message
co = checkout
cob = checkout -b
st = status
br = branch
cp = cherry-pick
up = pull

# Staging
addp = add --patch
addu = add -u
unstage = reset HEAD

# Diff
diffc = diff --cached
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"

# Log
lol = log --decorate --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit --date=auto:human
lolg = lol --graph
lola = lol --all --graph

# Push
pushf = push --force-with-lease

# Branch management
recent = branch --sort=-committerdate --format=\"%(committerdate:relative)%09%(refname:short)\"
st = status
unstage = reset HEAD

# Stash
sstash = stash save -u

# Find the merge commit for a given commit
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"

# Checkout a PR by number: git copr 123 branch-name
copr = "!copr() { git fetch origin pull/$1/head:$2 && git checkout $2; }; copr"

[column]
ui = auto

[color "status"]
header = white dim
added = green bold # or updated
added = green bold
changed = yellow bold
untracked = red bold dim
branch = magenta bold
Expand All @@ -46,7 +71,6 @@
[color "diff"]
meta = yellow
context = white dim
whitespace = red reverse
frag = magenta bold
old = red
new = green
Expand Down Expand Up @@ -96,3 +120,7 @@

[feature]
experimental = true

# Local overrides (not tracked) — machine-specific settings, work configs, etc.
[include]
path = ~/.gitconfig.local
16 changes: 16 additions & 0 deletions git/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# macOS
*.DS_Store

# Vim / Neovim
*.swp
*.swo
*~

# Logs
*.log

# Claude / AI tools
.claude

# Tags (ctags)
/tags
11 changes: 0 additions & 11 deletions gitignore

This file was deleted.

91 changes: 91 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env zsh
# install.sh — dotfiles installer
# Idempotent: safe to run multiple times.
# Usage: ./install.sh

set -e

DOTFILES_DIR="${0:a:h}"

# --- Colors ---
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

info() { echo "${BLUE}→${NC} $1" }
ok() { echo "${GREEN}✓${NC} $1" }
warn() { echo "${YELLOW}!${NC} $1" }
err() { echo "${RED}✗${NC} $1" }

# --- Helpers ---
link_file() {
local src="$1"
local dst="$2"

if [[ -L "$dst" ]] && [[ "$(readlink "$dst")" == "$src" ]]; then
ok "Already linked: $dst"
return
fi

if [[ -e "$dst" ]] || [[ -L "$dst" ]]; then
local backup="${dst}.backup.$(date +%Y%m%d%H%M%S)"
warn "Backing up existing $dst → $backup"
mv "$dst" "$backup"
fi

mkdir -p "$(dirname "$dst")"
ln -sf "$src" "$dst"
ok "Linked: $dst → $src"
}

# --- Main ---
echo ""
echo " ${BLUE}dotfiles installer${NC}"
echo " ${BLUE}==================${NC}"
echo ""

# Shell
info "Linking zsh config..."
link_file "${DOTFILES_DIR}/zsh/zshrc" "${HOME}/.zshrc"

# Git
info "Linking git config..."
link_file "${DOTFILES_DIR}/git/gitconfig" "${HOME}/.gitconfig"
link_file "${DOTFILES_DIR}/git/gitignore" "${HOME}/.gitignore"

# tmux
info "Linking tmux config..."
link_file "${DOTFILES_DIR}/tmux/tmux.conf" "${HOME}/.tmux.conf"
link_file "${DOTFILES_DIR}/tmux/tmux.mac.conf" "${HOME}/.tmux.mac.conf"

# Ghostty
info "Linking Ghostty config..."
if [[ "$OSTYPE" == "darwin"* ]]; then
ghostty_dir="${HOME}/Library/Application Support/com.mitchellh.ghostty"
else
ghostty_dir="${HOME}/.config/ghostty"
fi
link_file "${DOTFILES_DIR}/config/ghostty/config" "${ghostty_dir}/config"

# TPM (tmux plugin manager)
if [[ ! -d "${HOME}/.tmux/plugins/tpm" ]]; then
info "Installing TPM (tmux plugin manager)..."
git clone https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
ok "TPM installed"
else
ok "TPM already installed"
fi

echo ""
echo " ${GREEN}Done!${NC}"
echo ""
echo " Next steps:"
echo " 1. Restart your shell (or: source ~/.zshrc)"
echo " 2. Open tmux and press ${YELLOW}prefix + I${NC} to install tmux plugins"
echo ""
echo " Optional:"
echo " • Create ${YELLOW}~/.zshrc.local${NC} for machine-specific shell config"
echo " • Create ${YELLOW}~/.gitconfig.local${NC} for machine-specific git config"
echo ""
Loading