From 99e488604fbf6777691596f421efb6f61867db38 Mon Sep 17 00:00:00 2001 From: Rasmus Wejlgaard Date: Thu, 13 Aug 2026 20:12:10 +0100 Subject: [PATCH 1/2] Add git config set Aliases, sane defaults (autoprune, autoSetupRemote, rerere, diff3 conflict markers), a global gitignore, and a per-machine identity file. Also installs Delta and wires it in as the diff/log pager, writing to a separate untracked file rather than `git config --global` so it can never clobber the tracked gitconfig symlink. --- README.md | 16 +++++++++++++ config/sets/git/apply.sh | 48 +++++++++++++++++++++++++++++++++++++ config/sets/git/description | 4 ++++ config/sets/git/gitconfig | 38 +++++++++++++++++++++++++++++ config/sets/git/gitignore | 11 +++++++++ config/sets/git/identity | 3 +++ config/sets/git/manifest | 6 +++++ 7 files changed, 126 insertions(+) create mode 100755 config/sets/git/apply.sh create mode 100644 config/sets/git/description create mode 100644 config/sets/git/gitconfig create mode 100644 config/sets/git/gitignore create mode 100644 config/sets/git/identity create mode 100644 config/sets/git/manifest diff --git a/README.md b/README.md index b1322f1..9a16f91 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ config/ tmux/scripts/status.sh # Modular status bar renderer tmux/scripts/status.conf # Status gadget list (copied, per-machine) tmux/scripts/bluetooth-menu.sh # Bluetooth popup menu + git/ # Git config, aliases, global gitignore, Delta + description + manifest + gitconfig # Linked to ~/.config/git/config + gitignore # Linked to ~/.config/git/ignore + identity # Copied to ~/.config/git/identity, per-machine + apply.sh kde/ # KDE Plasma keyboard repeat settings description manifest @@ -86,6 +93,15 @@ tests/ # Dockerfiles used by CI to test installs per distro Config files are grouped into **sets** under `config/sets//`: - **`basic`** — everything this repo has always deployed (Neovim, Fish, Tmux) +- **`git`** — aliases (`st`/`co`/`br`/`ci`/`last`/`unstage`/`amend`), sane + defaults (autoprune on fetch, `autoSetupRemote` on push, rerere, `diff3` + conflict markers), a global gitignore, and a per-machine identity file + (`~/.config/git/identity`, copied once so different machines can carry + different `user.name`/`user.email`). It also installs **Delta** and wires + it in as the diff/log pager — written to a separate, untracked + `~/.config/git/local` file rather than `git config --global`, since with + no `~/.gitconfig` yet that resolves to the tracked `~/.config/git/config` + symlink - **`kde`** — sets the KDE Plasma keyboard repeat rate to 50/s with a 250ms delay (via `kwriteconfig5`/`6` on `kcminputrc`) - **`macos`** — the macOS system settings that differ from stock, applied via diff --git a/config/sets/git/apply.sh b/config/sets/git/apply.sh new file mode 100755 index 0000000..7e36486 --- /dev/null +++ b/config/sets/git/apply.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -euo pipefail + +# Installs Delta (a syntax-highlighting pager for git diff/show/log) and +# wires it in, mirroring config/sets/xfce/apply.sh's install_kitty. Skipped +# gracefully if this system's package manager doesn't have it (or isn't +# recognized) — the rest of the git set's aliases/config still apply either +# way, just with git's default (uncolored) pager. + +# Deliberately not `git config --global`: when ~/.gitconfig doesn't exist, +# that resolves to ~/.config/git/config — the *symlink back into this repo* +# — and would silently rewrite the tracked gitconfig file instead of local, +# per-machine state. `--file` pins the write to a separate, untracked file +# that gitconfig includes; a missing include target is a silent no-op, so +# this is safe to skip entirely when delta isn't available. +GIT_LOCAL_CONFIG=~/.config/git/local + +install_delta() { + command -v delta >/dev/null 2>&1 && return 0 + + if [ "$(uname)" == "Darwin" ]; then + command -v brew >/dev/null 2>&1 && brew install git-delta + elif [ "$(uname)" == "FreeBSD" ]; then + sudo pkg install -y git-delta + elif [ -f /etc/arch-release ]; then + sudo pacman -S --noconfirm git-delta + elif [ -f /etc/debian_version ]; then + export DEBIAN_FRONTEND=noninteractive + sudo apt update && sudo apt install -y git-delta + elif [ -f /etc/alpine-release ]; then + sudo apk add delta + elif [ -f /etc/redhat-release ]; then + sudo dnf install -y git-delta + elif [ -f /etc/gentoo-release ]; then + sudo emerge dev-util/git-delta + else + echo "Warning: don't know how to install delta on this system; install it manually." >&2 + return 1 + fi +} + +if install_delta && command -v delta >/dev/null 2>&1; then + git config --file "$GIT_LOCAL_CONFIG" core.pager "delta" + git config --file "$GIT_LOCAL_CONFIG" interactive.diffFilter "delta --color-only" + git config --file "$GIT_LOCAL_CONFIG" delta.navigate true +else + echo "Warning: delta not available; leaving git's default pager in place." >&2 +fi diff --git a/config/sets/git/description b/config/sets/git/description new file mode 100644 index 0000000..03f7f4c --- /dev/null +++ b/config/sets/git/description @@ -0,0 +1,4 @@ +Git: aliases (st/co/br/ci/last/unstage/amend), sane defaults (autoprune on +fetch, autoSetupRemote on push, rerere, diff3 conflict markers), a global +gitignore, a per-machine identity file, plus Delta installed and wired in +as the diff/log pager diff --git a/config/sets/git/gitconfig b/config/sets/git/gitconfig new file mode 100644 index 0000000..05da059 --- /dev/null +++ b/config/sets/git/gitconfig @@ -0,0 +1,38 @@ +# ~/.config/git/identity holds per-machine user.name/user.email (deployed +# once, then left alone). ~/.config/git/local holds settings apply.sh writes +# imperatively (e.g. Delta wiring, only if it installed successfully) — it's +# not tracked by this repo, and missing either file here is a silent no-op. +[include] + path = ~/.config/git/identity + path = ~/.config/git/local + +[core] + editor = nvim + excludesfile = ~/.config/git/ignore + +[init] + defaultBranch = main + +[color] + ui = auto + +[fetch] + prune = true + +[push] + autoSetupRemote = true + +[merge] + conflictStyle = diff3 + +[rerere] + enabled = true + +[alias] + st = status + co = checkout + br = branch + ci = commit + last = log -1 HEAD + unstage = reset HEAD -- + amend = commit --amend --no-edit diff --git a/config/sets/git/gitignore b/config/sets/git/gitignore new file mode 100644 index 0000000..87ee742 --- /dev/null +++ b/config/sets/git/gitignore @@ -0,0 +1,11 @@ +# macOS +.DS_Store + +# Windows +Thumbs.db +Desktop.ini + +# Editor backup/swap files +*~ +*.swp +*.swo diff --git a/config/sets/git/identity b/config/sets/git/identity new file mode 100644 index 0000000..72fca25 --- /dev/null +++ b/config/sets/git/identity @@ -0,0 +1,3 @@ +[user] + name = Rasmus Wejlgaard + email = pez@pez.sh diff --git a/config/sets/git/manifest b/config/sets/git/manifest new file mode 100644 index 0000000..c982748 --- /dev/null +++ b/config/sets/git/manifest @@ -0,0 +1,6 @@ +# See config/sets/basic/manifest for the full manifest format reference. + +link gitconfig ~/.config/git/config +link gitignore ~/.config/git/ignore +copy identity ~/.config/git/identity +run apply.sh From c940f06065e7cd6f855f164d34a706121d752fc4 Mon Sep 17 00:00:00 2001 From: Rasmus Wejlgaard Date: Thu, 13 Aug 2026 20:25:45 +0100 Subject: [PATCH 2/2] Fix delta's low-contrast blue defaults, enable line numbers file-style and line-numbers-{left,right}-style default to plain ANSI "blue", which reads poorly on a dark background; every other default style resolves to a specific RGB/256-color value. Line numbers are off by default. --- config/sets/git/apply.sh | 10 ++++++++++ config/sets/git/description | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/sets/git/apply.sh b/config/sets/git/apply.sh index 7e36486..97dde69 100755 --- a/config/sets/git/apply.sh +++ b/config/sets/git/apply.sh @@ -43,6 +43,16 @@ if install_delta && command -v delta >/dev/null 2>&1; then git config --file "$GIT_LOCAL_CONFIG" core.pager "delta" git config --file "$GIT_LOCAL_CONFIG" interactive.diffFilter "delta --color-only" git config --file "$GIT_LOCAL_CONFIG" delta.navigate true + + # Line numbers, off by default. Also overrides delta's default + # file-style and line-numbers-{left,right}-style, both plain ANSI + # "blue" — poor contrast on a dark background (`delta --show-config` + # shows every other default style resolved to a specific RGB/256-color + # value; these two are the only ones left at a raw, unadjusted ANSI name). + git config --file "$GIT_LOCAL_CONFIG" delta.line-numbers true + git config --file "$GIT_LOCAL_CONFIG" delta.file-style "bold yellow ul" + git config --file "$GIT_LOCAL_CONFIG" delta.line-numbers-left-style "white" + git config --file "$GIT_LOCAL_CONFIG" delta.line-numbers-right-style "white" else echo "Warning: delta not available; leaving git's default pager in place." >&2 fi diff --git a/config/sets/git/description b/config/sets/git/description index 03f7f4c..bb4ee85 100644 --- a/config/sets/git/description +++ b/config/sets/git/description @@ -1,4 +1,5 @@ Git: aliases (st/co/br/ci/last/unstage/amend), sane defaults (autoprune on fetch, autoSetupRemote on push, rerere, diff3 conflict markers), a global gitignore, a per-machine identity file, plus Delta installed and wired in -as the diff/log pager +as the diff/log pager with line numbers on and higher-contrast colors than +its low-contrast blue defaults