diff --git a/.gitmodules b/.gitmodules index 7b6a7d2..ff978d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "zprezto"] path = zprezto - url = https://github.com/jpmontez/prezto.git + url = https://github.com/sorin-ionescu/prezto.git [submodule "nvim/.config/nvim"] path = nvim/.config/nvim url = https://github.com/jpmontez/kickstart.nvim.git -[submodule "base16/.config/base16-shell"] - path = base16/.config/base16-shell - url = https://github.com/chriskempson/base16-shell.git diff --git a/Brewfile b/Brewfile index cd632e6..007f6cc 100644 --- a/Brewfile +++ b/Brewfile @@ -18,6 +18,7 @@ brew "stow" # symlink manager — deploys dotfiles packages into $HOME brew "zsh" # Homebrew zsh for a current release independent of macOS brew "tmux" # terminal multiplexer brew "git" # .gitconfig needs >= 2.38 (rebase.updateRefs, zdiff3); macOS ships Xcode's git +brew "fzf" # zsh Ctrl-R/Ctrl-T/Alt-C pickers (zsh/.zshrc) # ---- Editor & search ---- brew "neovim" # editor (configured via nvim/ package) @@ -29,6 +30,9 @@ brew "tree" # directory listing # ---- Dev tooling ---- brew "gh" # GitHub CLI — auth, PRs, issues brew "node" +brew "go" # also needed for nvim's gopls (Mason installs it via `go install`) +brew "python@3.14" +brew "uv" # Python package/project manager brew "shellcheck" # lints this repo's scripts (also run in CI) brew "xcodegen" # generate .xcodeproj from a spec brew "helm" @@ -38,7 +42,6 @@ brew "kubernetes-cli" # ---- macOS setup helpers ---- brew "dockutil" # CLI for managing Dock icons (used by macos/defaults.sh) brew "mas" # Mac App Store CLI (used by the mas entries below) -brew "terminal-notifier" # aliased in zsh/.aliases # ---- GUI apps ---- cask "ghostty" # GPU-accelerated terminal emulator @@ -48,6 +51,7 @@ cask "claude" # Claude desktop app cask "google-chrome" cask "docker-desktop" cask "1password" +cask "1password-cli" # `op` cask "sizeup" # keyboard-driven window manager cask "clipy" # clipboard manager with history cask "thaw" # menu bar manager — succeeded Ice @@ -65,6 +69,7 @@ cask "zoom" mas "Amphetamine", id: 937984704 # prevent sleep / screen saver mas "Balance Lock", id: 1019371109 # keep audio balance centred mas "Little Snitch Mini", id: 1629008763 # outbound connection monitor +mas "Pages", id: 361309726 # Safari extensions mas "1Password for Safari", id: 1569813296 diff --git a/README.md b/README.md index c468108..16a7633 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,14 @@ Each package directory mirrors `$HOME` and is symlinked in by `stow`: | Package | Symlinks to `$HOME` | Notes | |-----------|-----------------------------------|--------------------------------| -| `zsh` | `.zshrc`, `.zprofile`, `.aliases` | Shell config + prezto init | +| `zsh` | `.zshrc`, `.zprofile`, `.aliases`, `.zpreztorc` | Shell config + prezto init and settings | | `git` | `.gitconfig` | Git identity and defaults | | `tmux` | `.tmux.conf` | Prefix, vim keys, copy-paste | -| `ghostty` | `.config/ghostty/config` | Font, window size, bell behaviour | +| `ghostty` | `.config/ghostty/config` | Font, palette, bells, Option-as-Alt | | `ssh` | `.ssh/config` | Stowed `--no-folding` — see [below](#why-ssh-is-stowed-differently) | | `nvim` | `.config/nvim` | Submodule: kickstart.nvim | -| `base16` | `.config/base16-shell` | Submodule: base16 color scheme | -| `claude` | `.claude/settings.json` | Claude Code plugins, theme, model, notification hook | -| `zprezto` | `.zprezto`, `.zpreztorc`, etc. | Manual symlinks via bootstrap | +| `claude` | `.claude/statusline.sh` | Claude Code status line (`settings.json` is Claude Code's own, not stowed) | +| `zprezto` | `.zprezto`, `.zshenv`, etc. | Manual symlinks via bootstrap | | Path | Purpose | |---------------------|---------------------------------------------------------------| @@ -124,9 +123,8 @@ repo. `doctor.sh` flags it if it ever folds back. | Submodule | Repo | |-------------------------------|----------------------------------------| -| `zprezto` | `github.com/jpmontez/prezto` | +| `zprezto` | `github.com/sorin-ionescu/prezto` | | `nvim/.config/nvim` | `github.com/jpmontez/kickstart.nvim` | -| `base16/.config/base16-shell` | `github.com/chriskempson/base16-shell` | `bootstrap.sh` initializes them; refresh with `git submodule update --init --recursive`. diff --git a/base16/.config/base16-shell b/base16/.config/base16-shell deleted file mode 160000 index 588691b..0000000 --- a/base16/.config/base16-shell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 588691ba71b47e75793ed9edfcfaa058326a6f41 diff --git a/doctor.sh b/doctor.sh index 0c7f768..b9095dc 100755 --- a/doctor.sh +++ b/doctor.sh @@ -79,7 +79,8 @@ else hint "./bootstrap.sh — unfolds it and restows with --no-folding" else ok "~/.ssh is a real directory" - perms="$(stat -f '%Lp' "$HOME/.ssh" 2>/dev/null || echo "?")" + # GNU stat first (Linux); BSD stat (macOS) rejects -c and falls through. + perms="$(stat -c '%a' "$HOME/.ssh" 2>/dev/null || stat -f '%Lp' "$HOME/.ssh" 2>/dev/null || echo "?")" if [[ "$perms" == "700" ]]; then ok "~/.ssh permissions are 700" else diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config index 36c5d8c..c9498fd 100644 --- a/ghostty/.config/ghostty/config +++ b/ghostty/.config/ghostty/config @@ -8,12 +8,13 @@ window-width = 80 # which is unfocused-only and silent. bell-features = system,audio,attention,title -# base16-ocean, pinned here rather than left to base16-shell alone. The shell -# script only repaints the palette via OSC escapes once an interactive zsh -# starts, so the terminal would otherwise open on Ghostty's default scheme and -# flip mid-startup — and anything not launched from an interactive shell would -# keep the wrong palette. Values are byte-identical to -# base16-shell/scripts/base16-ocean.sh, so the two never disagree. +# Left Option sends Alt (Meta) so shell, tmux and nvim Alt bindings work — +# e.g. fzf's Alt-C, zsh's Alt-. (insert last argument), Alt-b/f word moves. +# Right Option still composes accented characters. +macos-option-as-alt = left + +# base16-ocean. This is the one terminal palette: tmux styles with these ANSI +# slots and nvim's base16-ocean colorscheme uses the same values. # Slots 16-21 carry base09/0F/01/02/04/06, which base16 uses for the extra # neutrals (e.g. colour20 = base04) that plain ANSI has no room for. palette = 0=#2b303b diff --git a/lib.sh b/lib.sh index 2fc1798..040af94 100644 --- a/lib.sh +++ b/lib.sh @@ -13,7 +13,7 @@ DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" MACHINE_FILE="$DOTFILES_DIR/.machine" # Stow packages carrying no special options. -STOW_PACKAGES=(zsh git tmux ghostty nvim base16 claude) +STOW_PACKAGES=(zsh git tmux ghostty nvim claude) # ssh is stowed on its own: --no-folding keeps ~/.ssh a real directory holding a # symlinked config. Folded, ~/.ssh would itself be a symlink into this repo, and diff --git a/macos/README.md b/macos/README.md index f3507ef..70d8e78 100644 --- a/macos/README.md +++ b/macos/README.md @@ -6,6 +6,7 @@ One-time system setup for fresh macOS installs. Not a stow package. ```bash bash macos/defaults.sh # apply bash macos/defaults.sh --check # report drift, write nothing, exit 1 if any +bash macos/defaults.sh --capture # re-copy SizeUp's live shortcuts into SizeUp.plist ``` Idempotent — safe to re-run. `bootstrap.sh` prompts to run it; `doctor.sh` calls @@ -24,6 +25,11 @@ Both modes walk that same table — apply calls `defaults write`, check calls apply writes. Booleans are normalised before comparison, since `defaults read` prints `0`/`1` rather than `false`/`true`. +Nested values (dicts, arrays) use type `plist`: the row's value names a file in +`macos/` holding that key's value. Apply passes the XML straight to +`defaults write`, which keeps every type; check compares the XML `plutil` +renders from both sides. + The Caps Lock remap, Dock contents, login items, Touch ID, and the firewall need more than a scalar comparison, so each has a matching `process_*` function with an explicit check branch. @@ -34,6 +40,13 @@ Read `SETTINGS` for the exact list. In summary: appearance, keyboard, text substitution, trackpad, Dock, Finder, screen saver, menu bar, and per-app defaults for SizeUp and Clipy. Beyond the table: +- **SizeUp** — every shortcut and window size, stored as `plist` rows backed by + [`SizeUp.plist`](SizeUp.plist). After changing SizeUp's preferences, run + `bash macos/defaults.sh --capture` and commit the diff. Capture copies only + the keys listed in `SETTINGS`, so usage counters, update timestamps, and window + positions in the same domain stay out of the repo; a new key needs its row + added first. Quit and relaunch SizeUp after an apply so it picks the values up. + - **Dock contents** — populated via `dockutil` from `DOCK_APPS`. Entries whose app doesn't exist on this macOS version are skipped rather than aborting the run. - **Screen saver** — password required immediately. *Best-effort:* since Ventura this pane is partly system-managed and the write may not stick; `--check` shows it as drift if so. - **Security** — Touch ID for `sudo` and the application firewall with stealth mode. FileVault is never touched here — turning it on generates a recovery key a human has to record, so `doctor.sh` reports its status instead. diff --git a/macos/SizeUp.plist b/macos/SizeUp.plist new file mode 100644 index 0000000..9d91e05 --- /dev/null +++ b/macos/SizeUp.plist @@ -0,0 +1,197 @@ + + + + + Center + + ComboCode + 8 + ComboFlags + 1835008 + + Down + + ComboCode + 125 + ComboFlags + 1835008 + Height + 0.5 + Width + 1 + X + 0.0 + Y + 0.5 + + Full Screen + + ComboCode + 46 + ComboFlags + 1835008 + Height + 1 + Width + 1 + X + 0.0 + Y + 0.0 + + Left + + ComboCode + 123 + ComboFlags + 1835008 + Height + 1 + Width + 0.5 + X + 0.0 + Y + 0.0 + + Lower Left + + ComboCode + 125 + ComboFlags + 917504 + Height + 0.5 + Width + 0.5 + X + 0.0 + Y + 0.5 + + Lower Right + + ComboCode + 124 + ComboFlags + 917504 + Height + 0.5 + Width + 0.5 + X + 0.5 + Y + 0.5 + + Next Monitor + + ComboCode + 124 + ComboFlags + 786432 + + Prev Monitor + + ComboCode + 123 + ComboFlags + 786432 + + Right + + ComboCode + 124 + ComboFlags + 1835008 + Height + 1 + Width + 0.5 + X + 0.5 + Y + 0.0 + + SnapBack + + ComboCode + 44 + ComboFlags + 1835008 + + Space Above + + ComboCode + 126 + ComboFlags + 1310720 + + Space Below + + ComboCode + 125 + ComboFlags + 1310720 + + Space Next + + ComboCode + 124 + ComboFlags + 1310720 + + Space Prev + + ComboCode + 123 + ComboFlags + 1310720 + + Up + + ComboCode + 126 + ComboFlags + 1835008 + Height + 0.5 + Width + 1 + X + 0.0 + Y + 0.0 + + Upper Left + + ComboCode + 123 + ComboFlags + 917504 + Height + 0.5 + Width + 0.5 + X + 0.0 + Y + 0.0 + + Upper Right + + ComboCode + 126 + ComboFlags + 917504 + Height + 0.5 + Width + 0.5 + X + 0.5 + Y + 0.0 + + + diff --git a/macos/defaults.sh b/macos/defaults.sh index 9f74c1f..ca3d5ed 100755 --- a/macos/defaults.sh +++ b/macos/defaults.sh @@ -3,8 +3,10 @@ # # bash macos/defaults.sh apply everything # bash macos/defaults.sh --check report drift, write nothing, exit 1 if any +# bash macos/defaults.sh --capture copy live values of plist-type settings +# (SizeUp's shortcuts) into their data files # -# Settings live in one SETTINGS table consumed by both modes, so a check can +# Settings live in one SETTINGS table consumed by every mode, so a check can # never fall out of sync with what apply writes. # # Some changes (Caps Lock remap) require logout to take effect. @@ -16,11 +18,14 @@ if [[ "$(uname)" != "Darwin" ]]; then exit 1 fi +MACOS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + MODE=apply case "${1:-}" in - --check) MODE=check ;; - "") ;; - *) echo "usage: ${0##*/} [--check]" >&2; exit 2 ;; + --check) MODE=check ;; + --capture) MODE=capture ;; + "") ;; + *) echo "usage: ${0##*/} [--check|--capture]" >&2; exit 2 ;; esac drift=0 @@ -36,6 +41,10 @@ note_ok() { [[ "$MODE" == check ]] && echo " ✓ $*"; return 0; } # currenthost → defaults -currentHost write (per-machine, ByHost plist) # domain -g is the global domain in -currentHost scope; NSGlobalDomain elsewhere # type bool | int | string +# plist → value names a file in macos/ holding 's value, for +# nested dicts/arrays (user scope only). The rows double as +# the allowlist --capture copies, so volatile or private keys +# in the same domain never reach the repo. # --------------------------------------------------------------------------- SETTINGS=( # ---- Appearance ---- @@ -52,12 +61,12 @@ SETTINGS=( "user|NSGlobalDomain|AppleKeyboardUIMode|int|3" # Tab moves between all controls # ---- Text substitution ---- - # Smart quotes and em-dashes corrupt code, paths, and commit messages. - "user|NSGlobalDomain|NSAutomaticQuoteSubstitutionEnabled|bool|false" + # Em-dashes and autocorrect mangle paths, flags, and commit messages. "user|NSGlobalDomain|NSAutomaticDashSubstitutionEnabled|bool|false" "user|NSGlobalDomain|NSAutomaticSpellingCorrectionEnabled|bool|false" - # Capitalization and period substitution stay on — they don't mangle code, - # and this matches the live machine. + # Smart quotes, capitalization, and period substitution stay on by + # preference; terminals and code editors ignore these substitutions. + "user|NSGlobalDomain|NSAutomaticQuoteSubstitutionEnabled|bool|true" "user|NSGlobalDomain|NSAutomaticCapitalizationEnabled|bool|true" "user|NSGlobalDomain|NSAutomaticPeriodSubstitutionEnabled|bool|true" @@ -100,6 +109,27 @@ SETTINGS=( # ---- Third-party apps ---- "user|com.irradiatedsoftware.SizeUp|MenuEnabled|bool|false" "user|com.irradiatedsoftware.SizeUp|suppressMenuBarDisabledPopup|bool|true" + "user|com.irradiatedsoftware.SizeUp|CenterResizeEnabled|bool|false" + "user|com.irradiatedsoftware.SizeUp|ShortcutsDisabled|bool|false" + # One row per SizeUp action: its shortcut (ComboCode/ComboFlags) and, for + # sizing actions, the window rect as screen fractions (X/Y/Width/Height). + "user|com.irradiatedsoftware.SizeUp|Center|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Down|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Full Screen|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Left|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Lower Left|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Lower Right|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Next Monitor|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Prev Monitor|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Right|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|SnapBack|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Space Above|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Space Below|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Space Next|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Space Prev|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Up|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Upper Left|plist|SizeUp.plist" + "user|com.irradiatedsoftware.SizeUp|Upper Right|plist|SizeUp.plist" "user|com.clipy-app.Clipy|kCPYPrefShowStatusItemKey|bool|false" ) @@ -163,11 +193,50 @@ write_default() { fi } +# process_plist_setting — a nested value stored under +# in . `defaults write` accepts the XML document as-is and keeps +# every type; check compares both sides as plutil-rendered XML. +process_plist_setting() { + local domain="$1" key="$2" file="$3" actual want + want="$(plutil -extract "$key" xml1 -o - "$file")" + + if [[ "$MODE" == apply ]]; then + defaults write "$domain" "$key" "$want" + return 0 + fi + + actual="$(defaults export "$domain" - | plutil -extract "$key" xml1 -o - - 2>/dev/null)" || true + + if [[ "$MODE" == capture ]]; then + if [[ -z "$actual" ]]; then + echo " ! $domain $key is unset — ${file##*/} left unchanged" >&2 + return 0 + fi + plutil -replace "$key" -xml "$actual" "$file" + echo " ✓ captured $domain $key" + return 0 + fi + + if [[ -z "$actual" ]]; then + note_drift "$domain $key — unset, want the value in ${file##*/}" + elif [[ "$actual" != "$want" ]]; then + note_drift "$domain $key — differs from ${file##*/}" + else + note_ok "$domain $key" + fi +} + process_settings() { local entry scope domain key type value actual want for entry in "${SETTINGS[@]}"; do IFS='|' read -r scope domain key type value <<<"$entry" + if [[ "$type" == plist ]]; then + process_plist_setting "$domain" "$key" "$MACOS_DIR/$value" + continue + fi + [[ "$MODE" == capture ]] && continue + if [[ "$MODE" == apply ]]; then write_default "$scope" "$domain" "$key" "$type" "$value" continue @@ -338,6 +407,13 @@ process_firewall() { # Run # --------------------------------------------------------------------------- +if [[ "$MODE" == capture ]]; then + echo ">>> Capturing plist-type settings into macos/..." + process_settings + echo ">>> Review with: git diff macos/" + exit 0 +fi + if [[ "$MODE" == apply ]]; then echo ">>> Applying macOS defaults..." # Quit System Settings so it doesn't clobber writes on save. diff --git a/nvim/.config/nvim b/nvim/.config/nvim index ede5cbf..7aaa196 160000 --- a/nvim/.config/nvim +++ b/nvim/.config/nvim @@ -1 +1 @@ -Subproject commit ede5cbfc0a1ef039693d9856eff9e583a6b4ae2d +Subproject commit 7aaa1966d1c712c7e2fc4918210dc73eeec12782 diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index a37781b..58be2ba 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -3,11 +3,20 @@ unbind C-b set -g prefix C-a bind-key a send-prefix -bind C-k clear-history - # set scrollback set-option -g history-limit 200000 +# Replaces tmux-sensible: only what it changed from tmux 3.7 defaults. +set -g display-time 4000 # messages stay up 4s (default 750ms) +set -g status-interval 5 # redraw the status bar/clock every 5s (default 15) +set -g status-keys emacs # emacs keys at the : prompt (default is vi when $EDITOR is nvim) +setw -g aggressive-resize on # size a window to the clients viewing it, not the whole session +bind C-p previous-window +bind C-n next-window + +# Pass focus in/out to panes; nvim :checkhealth wants it for autoread/FocusGained. +set -g focus-events on + # number windows/panes from 1 (next to the number keys, unlike 0) and close # numbering gaps automatically when a window is closed set -g base-index 1 @@ -37,7 +46,7 @@ set -as terminal-features ",*:RGB" set -g monitor-bell on set -g bell-action any # The bell style itself is dotbar's (`bg=colour4,fg=colour0,bold`); setting it -# here does nothing, since tpm runs last and overwrites it. +# here does nothing, since dotbar loads later (via tpm) and overwrites it. # quick switch between panes unbind ^A @@ -54,17 +63,13 @@ bind-key -r Right resize-pane -R 10 # Use vim keybindings in copy mode setw -g mode-keys vi -# Setup 'v' to begin selection as in Vim +# Vim-style selection. Copies reach the system clipboard through set-clipboard +# (OSC 52 → Ghostty), so no pbcopy/xclip — and it works over SSH too. +# y copies and leaves copy mode; Enter copies and stays in it. bind-key -T copy-mode-vi 'v' send -X begin-selection -if-shell "uname | grep -q Darwin" \ - "bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'pbcopy'" \ - "bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'" - -# Update default binding of `Enter` to also use copy-pipe +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel unbind -T copy-mode-vi Enter -if-shell "uname | grep -q Darwin" \ - "bind-key -T copy-mode-vi Enter send -X copy-pipe 'pbcopy'" \ - "bind-key -T copy-mode-vi Enter send -X copy-pipe 'xclip -in -selection clipboard'" +bind-key -T copy-mode-vi Enter send -X copy-selection # Mouse support (scroll, resize, click-to-focus) set -g mouse on @@ -78,7 +83,7 @@ set -g set-titles on set -g set-titles-string '#{pane_title}' # Style with ANSI colours (not hex) so the status bar, borders, and popups -# follow whatever base16 scheme is currently active instead of a fixed palette +# follow the base16 palette Ghostty pins (ghostty/config) instead of a fixed one set -g pane-border-style "fg=colour8" set -g pane-active-border-style "fg=colour4" set -g popup-border-style "fg=colour4" @@ -130,7 +135,6 @@ bind G display-popup -d "#{pane_current_path}" -w 80% -h 80% -k "git status" bind s display-popup -E -w 70% -h 60% "tmux choose-tree -Zs" set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'vaaleyard/tmux-dotbar' @@ -139,7 +143,6 @@ set -g @plugin 'vaaleyard/tmux-dotbar' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @resurrect-capture-pane-contents 'on' -set -g @resurrect-strategy-nvim 'session' set -g @resurrect-processes '"~claude->claude --continue"' set -g @continuum-restore 'on' diff --git a/zprezto b/zprezto index e564195..cff2d01 160000 --- a/zprezto +++ b/zprezto @@ -1 +1 @@ -Subproject commit e5641955d138d79ac091434e7ac51a764f0afd9b +Subproject commit cff2d01871425b1b80710f8ec6a475c5a53145b4 diff --git a/zsh/.zpreztorc b/zsh/.zpreztorc new file mode 100644 index 0000000..20709f2 --- /dev/null +++ b/zsh/.zpreztorc @@ -0,0 +1,19 @@ +# Prezto settings; ~/.zprezto/runcoms/zpreztorc lists every option. + +zstyle ':prezto:*:*' color 'yes' + +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'history-substring-search' \ + 'prompt' + +zstyle ':prezto:module:editor' key-bindings 'emacs' + +zstyle ':prezto:module:prompt' theme 'pure' diff --git a/zsh/.zprofile b/zsh/.zprofile index 99f6086..0a7ef66 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,5 +1,2 @@ # https://github.com/openai/codex/issues/6960#issuecomment-3556921714 -if [[ "$(uname)" == "Darwin" ]]; then - eval "$(/opt/homebrew/bin/brew shellenv zsh)" -fi - +[[ -x /opt/homebrew/bin/brew ]] && eval "$(/opt/homebrew/bin/brew shellenv zsh)" diff --git a/zsh/.zshrc b/zsh/.zshrc index 340109d..c9da9ee 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,17 +1,6 @@ # ---- PATH dedupe ---- typeset -U path PATH -# ---- base16 shell ---- -# profile_helper only applies a theme if ~/.base16_theme exists; without this -# it just defines the base16_* aliases and leaves the terminal on its own -# palette. Ghostty pins the same scheme statically, so this mainly keeps the -# runtime base16_* switchers working and exports BASE16_THEME. -BASE16_SHELL="$HOME/.config/base16-shell/" -BASE16_DEFAULT_THEME=ocean -[ -n "$PS1" ] && \ - [ -s "$BASE16_SHELL/profile_helper.sh" ] && \ - source "$BASE16_SHELL/profile_helper.sh" - # ---- prezto ---- if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" @@ -30,8 +19,11 @@ print() { # ---- environment ---- export COLORTERM=truecolor export EDITOR=nvim +export VISUAL=nvim # -F: quit if one screen, -R: pass raw color, -X: don't clear screen on exit export PAGER='less -FRX' +# man pages in nvim: base16 colours, K / Ctrl-] follow references +export MANPAGER='nvim +Man!' export CLAUDE_CODE_NO_FLICKER=1 # ---- aliases / wrappers ---- @@ -48,11 +40,12 @@ tmux() { # Resume the most recent Claude Code session for the current directory when # invoked bare, falling back to a fresh session if none exists. -# Claude Code stores sessions under ~/.claude/projects/ /; -# ${PWD//\//-} encodes the path, and (N) suppresses the glob error on no match. +# Claude Code stores sessions under ~/.claude/projects// with every +# non-alphanumeric character (/, ., space, ...) replaced by '-', which +# ${PWD//[^[:alnum:]]/-} reproduces; (N) suppresses the glob error on no match. claude() { if (( $# == 0 )); then - local sessions=("$HOME/.claude/projects/${PWD//\//-}"/*.jsonl(N)) + local sessions=("$HOME/.claude/projects/${PWD//[^[:alnum:]]/-}"/*.jsonl(N)) if (( ${#sessions} > 0 )); then command claude --continue else @@ -64,6 +57,16 @@ claude() { } [ -f "$HOME/.aliases" ] && source "$HOME/.aliases" +# ---- fzf ---- +# Ctrl-R history, Ctrl-T files, Alt-C cd (Alt needs Ghostty's +# macos-option-as-alt). Sourced after prezto so its Ctrl-R binding wins. +# fd honours .gitignore; --tmux opens pickers in a tmux popup (ignored outside +# tmux); --color=16 uses the ANSI palette, like tmux's styling. +export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_DEFAULT_OPTS='--tmux 80%,60% --color=16' +(( $+commands[fzf] )) && source <(fzf --zsh) + # ---- Go ---- export GOPATH="${HOME}/Development/go" path=("${GOPATH}/bin" $path)