From 003550e10c424180197c4514a02c3e09f4bacec4 Mon Sep 17 00:00:00 2001 From: CI User Date: Thu, 9 Jul 2026 16:31:02 +0000 Subject: [PATCH 1/3] Consolidate dotfiles improvements into one branch - Add ~/.bin to Fish PATH for chezmoi-managed scripts - Add nord-dircolors git-repo external with pinned branch - Pin all chezmoi externals via clone --branch for Renovate tracking - Prompt for machine name at chezmoi init (dot_name.tmpl) - Add Fish custom prompts matching zsh/tmux identity layout - Port zsh shell helpers to Fish functions (cdgr, fpr, serve, etc.) - Switch tmux to Catppuccin Macchiato theme - Add chezmoi template validation CI workflow - Add Renovate config and weekly OSV/Homebrew dependency audit - Reconcile README with actual layout and new features Note: archive-type externals conflict with vim/zsh/shell symlink layout, so externals remain git-repo with explicit branch pins. Co-authored-by: Huy Pham --- .chezmoi.toml.tmpl | 2 + .chezmoiexternal.toml | 27 ++++++ .github/renovate.json | 74 +++++++++++++++ .github/workflows/chezmoi.yml | 47 ++++++++++ .github/workflows/dependency-audit.yml | 91 +++++++++++++++++++ README.md | 45 +++++++-- dot_config/fish/conf.d/00-path.fish.tmpl | 3 +- dot_config/fish/functions/_machine_name.fish | 7 ++ dot_config/fish/functions/cdgr.fish | 3 + dot_config/fish/functions/fish_prompt.fish | 15 +++ .../fish/functions/fish_right_prompt.fish | 12 +++ dot_config/fish/functions/fpr.fish | 25 +++++ dot_config/fish/functions/jump.fish | 3 + dot_config/fish/functions/nonascii.fish | 3 + dot_config/fish/functions/serve.fish | 5 + dot_config/fish/functions/syspip.fish | 7 ++ dot_config/fish/functions/xin.fish | 5 + dot_name.tmpl | 2 +- dot_tmux.conf | 31 ++++--- 19 files changed, 384 insertions(+), 23 deletions(-) create mode 100644 .github/renovate.json create mode 100644 .github/workflows/chezmoi.yml create mode 100644 .github/workflows/dependency-audit.yml create mode 100644 dot_config/fish/functions/_machine_name.fish create mode 100644 dot_config/fish/functions/cdgr.fish create mode 100644 dot_config/fish/functions/fish_prompt.fish create mode 100644 dot_config/fish/functions/fish_right_prompt.fish create mode 100644 dot_config/fish/functions/fpr.fish create mode 100644 dot_config/fish/functions/jump.fish create mode 100644 dot_config/fish/functions/nonascii.fish create mode 100644 dot_config/fish/functions/serve.fish create mode 100644 dot_config/fish/functions/syspip.fish create mode 100644 dot_config/fish/functions/xin.fish diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index f9d36e7..a114fa5 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -1,9 +1,11 @@ {{- $gitName := promptStringOnce . "git_name" "Git user.name for ~/.gitconfig_local" "" -}} {{- $gitEmail := promptStringOnce . "git_email" "Git user.email for ~/.gitconfig_local" "" -}} {{- $githubUser := promptStringOnce . "github_user" "GitHub username for [github] user in ~/.gitconfig_local" "" -}} +{{- $machineName := promptStringOnce . "machine_name" "Machine name for ~/.name (prompts, tmux status)" .chezmoi.hostname -}} mode = "symlink" [data] git_name = {{ $gitName | quote }} git_email = {{ $gitEmail | quote }} github_user = {{ $githubUser | quote }} +machine_name = {{ $machineName | quote }} diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml index 2484ec4..982ca48 100644 --- a/.chezmoiexternal.toml +++ b/.chezmoiexternal.toml @@ -1,10 +1,13 @@ # Paths are home-relative (e.g. .vim/...) so clones follow ~/.vim → sourceDir/vim. # Vim: prefer vim-polyglot for syntax; keep vim-go (disable polyglot go); NERDTree = preservim fork. +# Plugin versions are pinned via clone --branch so Renovate can bump them in this file. [".vim/pack/vendor/start/lightline.vim"] type = "git-repo" url = "https://github.com/itchyny/lightline.vim" refreshPeriod = "0" +[".vim/pack/vendor/start/lightline.vim".clone] +args = ["--branch", "d042c506cb2e7a59112a72447e0b5fe8739d9d1d", "--depth", "1"] [".vim/pack/vendor/start/lightline.vim".pull] args = ["--ff-only"] @@ -12,6 +15,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/preservim/nerdtree.git" refreshPeriod = "0" +[".vim/pack/vendor/start/nerdtree".clone] +args = ["--branch", "7.1.3", "--depth", "1"] [".vim/pack/vendor/start/nerdtree".pull] args = ["--ff-only"] @@ -19,6 +24,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/fatih/vim-go.git" refreshPeriod = "0" +[".vim/pack/vendor/start/vim-go".clone] +args = ["--branch", "v1.29", "--depth", "1"] [".vim/pack/vendor/start/vim-go".pull] args = ["--ff-only"] @@ -26,6 +33,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/sheerun/vim-polyglot.git" refreshPeriod = "0" +[".vim/pack/vendor/start/vim-polyglot".clone] +args = ["--branch", "v4.17.0", "--depth", "1"] [".vim/pack/vendor/start/vim-polyglot".pull] args = ["--ff-only"] @@ -33,6 +42,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/kaicataldo/material.vim.git" refreshPeriod = "0" +[".vim/pack/vendor/start/material.vim".clone] +args = ["--branch", "32f423c825ee89a37d66e3d8f00e777c7d8a41ab", "--depth", "1"] [".vim/pack/vendor/start/material.vim".pull] args = ["--ff-only"] @@ -40,6 +51,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/haya14busa/incsearch.vim" refreshPeriod = "0" +[".vim/pack/vendor/start/incsearch.vim".clone] +args = ["--branch", "v2.0.1", "--depth", "1"] [".vim/pack/vendor/start/incsearch.vim".pull] args = ["--ff-only"] @@ -48,6 +61,8 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/zsh-users/zsh-syntax-highlighting.git" refreshPeriod = "0" +[".zsh/plugins/zsh-syntax-highlighting".clone] +args = ["--branch", "0.8.0", "--depth", "1"] [".zsh/plugins/zsh-syntax-highlighting".pull] args = ["--ff-only"] @@ -55,5 +70,17 @@ args = ["--ff-only"] type = "git-repo" url = "https://github.com/zsh-users/zsh-completions.git" refreshPeriod = "0" +[".zsh/plugins/zsh-completions".clone] +args = ["--branch", "0.36.0", "--depth", "1"] [".zsh/plugins/zsh-completions".pull] args = ["--ff-only"] + +# Shell +[".shell/plugins/nord-dircolors"] +type = "git-repo" +url = "https://github.com/nordtheme/dircolors.git" +refreshPeriod = "0" +[".shell/plugins/nord-dircolors".clone] +args = ["--branch", "v0.2.0", "--depth", "1"] +[".shell/plugins/nord-dircolors".pull] +args = ["--ff-only"] diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..2da80cb --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,74 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + ":dependencyDashboard", + ":semanticCommits" + ], + "schedule": ["before 6am on monday"], + "labels": ["dependencies"], + "prConcurrentLimit": 5, + "customManagers": [ + { + "customType": "regex", + "description": "Chezmoi git-repo externals pinned via clone --branch", + "managerFilePatterns": ["^\\.chezmoiexternal\\.toml$"], + "matchStrings": [ + "\\[\"\\.(?[^\"]+)\"\\][\\s\\S]*?url = \"https://github\\.com/(?[^/]+/[^/]+(?:\\.git)?)\"[\\s\\S]*?args = \\[\"--branch\", \"(?[^\"]+)\"" + ], + "datasourceTemplate": "github-tags", + "versioningTemplate": "semver" + }, + { + "customType": "regex", + "description": "Homebrew formulae in dot_Brewfile", + "managerFilePatterns": ["^dot_Brewfile$"], + "matchStrings": [ + "^brew \"(?[a-z0-9][a-z0-9+@._/-]*)\"\\s*$" + ], + "datasourceTemplate": "repology", + "lookupNameTemplate": "homebrew/{{{depName}}}", + "versioningTemplate": "loose" + }, + { + "customType": "regex", + "description": "Homebrew casks in dot_Brewfile", + "managerFilePatterns": ["^dot_Brewfile$"], + "matchStrings": [ + "^cask \"(?[a-z0-9][a-z0-9+@._/-]*)\"\\s*$" + ], + "datasourceTemplate": "repology", + "lookupNameTemplate": "homebrew_casks/{{{depName}}}", + "versioningTemplate": "loose" + }, + { + "customType": "regex", + "description": "Go tools installed via brew bundle go directive", + "managerFilePatterns": ["^dot_Brewfile$"], + "matchStrings": [ + "^go \"(?[^\"]+)\"\\s*$" + ], + "datasourceTemplate": "go", + "versioningTemplate": "go" + } + ], + "packageRules": [ + { + "description": "Group chezmoi external bumps", + "matchManagers": ["custom.regex"], + "matchFileNames": [".chezmoiexternal.toml"], + "groupName": "chezmoi externals" + }, + { + "description": "Group Homebrew bundle updates", + "matchManagers": ["custom.regex"], + "matchFileNames": ["dot_Brewfile"], + "groupName": "homebrew bundle" + }, + { + "description": "Group GitHub Actions", + "matchManagers": ["github-actions"], + "groupName": "github-actions" + } + ] +} diff --git a/.github/workflows/chezmoi.yml b/.github/workflows/chezmoi.yml new file mode 100644 index 0000000..cd5467b --- /dev/null +++ b/.github/workflows/chezmoi.yml @@ -0,0 +1,47 @@ +name: chezmoi + +on: + push: + branches: [main] + pull_request: + +env: + CHEZMOI_VERSION: v2.71.0 + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install chezmoi + run: | + sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin" "$CHEZMOI_VERSION" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Write test chezmoi config + run: | + mkdir -p "$HOME/.config/chezmoi" + cat > "$HOME/.config/chezmoi/chezmoi.toml" < /dev/null + done < <(find . -name '*.tmpl' -not -path './.git/*' -print0) + + - name: Dry-run apply + run: chezmoi apply --dry-run --verbose --refresh-externals=never diff --git a/.github/workflows/dependency-audit.yml b/.github/workflows/dependency-audit.yml new file mode 100644 index 0000000..c6ff978 --- /dev/null +++ b/.github/workflows/dependency-audit.yml @@ -0,0 +1,91 @@ +name: dependency-audit + +on: + schedule: + - cron: '0 8 * * 1' + workflow_dispatch: + pull_request: + paths: + - .chezmoiexternal.toml + - dot_Brewfile + - .github/workflows/dependency-audit.yml + +jobs: + osv-scan-externals: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install osv-scanner + run: | + go install github.com/google/osv-scanner/v2/cmd/osv-scanner@v2.3.1 + echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" + + - name: Clone pinned chezmoi externals + run: | + set -euo pipefail + mkdir -p /tmp/dotfiles-externals + python3 <<'PY' + import pathlib + import re + import subprocess + + text = pathlib.Path(".chezmoiexternal.toml").read_text() + entries = re.findall( + r'\["([^"]+)"\]\s*\ntype = "git-repo"\s*\nurl = "([^"]+)"[\s\S]*?args = \["--branch", "([^"]+)"', + text, + ) + for path, repo_url, branch in entries: + if repo_url.endswith(".git"): + repo_url = repo_url[:-4] + name = path.replace("/", "_").lstrip(".") + dest = pathlib.Path("/tmp/dotfiles-externals") / name + print(f"Cloning {repo_url} @ {branch} -> {dest}") + subprocess.run( + [ + "git", "clone", "--depth", "1", + "--branch", branch, + repo_url + ".git", str(dest), + ], + check=True, + ) + PY + + - name: Scan externals with OSV + run: osv-scanner scan source --recursive /tmp/dotfiles-externals + + brew-outdated-report: + runs-on: macos-latest + continue-on-error: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Report outdated Homebrew packages from dot_Brewfile + run: | + set -uo pipefail + brew update + { + echo "## Homebrew packages referenced in dot_Brewfile" + echo '```' + while read -r line; do + case "$line" in + brew\ \"*\"|cask\ \"*\") + pkg=$(echo "$line" | sed -E 's/^(brew|cask) "([^"]+)".*/\2/') + kind=$(echo "$line" | sed -E 's/^(brew|cask).*/\1/') + if [ "$kind" = cask ]; then + outdated=$(brew outdated --cask --quiet "$pkg" 2>/dev/null || true) + else + outdated=$(brew outdated --formula --quiet "$pkg" 2>/dev/null || true) + fi + if [ -n "$outdated" ]; then + echo "OUTDATED $kind $pkg" + else + echo "current $kind $pkg" + fi + ;; + esac + done < dot_Brewfile + echo '```' + } >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index e895c35..46ba5b8 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,18 @@ **Shell:** **Fish** is the intended daily driver (`~/.config/fish/` from **`dot_config/fish/`**). **Zsh** remains available (`dot_zshrc.tmpl`, `~/.zsh` symlink) for compatibility or scripts. -Large trees (`vim/`, `zsh/`, `shell/` under the source dir) are populated by **`git-repo` externals** in [`.chezmoiexternal.toml`](.chezmoiexternal.toml). External paths are **home-relative** (`.vim/…`, `.zsh/…`, `.shell/…`) so clones land behind the `~/.vim`, `~/.zsh`, and `~/.shell` symlinks into this repo. +Large trees (`vim/`, `zsh/`, `shell/` under the source dir) are populated by **pinned `git-repo` externals** in [`.chezmoiexternal.toml`](.chezmoiexternal.toml). External paths are **home-relative** (`.vim/…`, `.zsh/…`, `.shell/…`) so clones land behind the `~/.vim`, `~/.zsh`, and `~/.shell` symlinks into this repo. Plugin versions are pinned via `clone.args = ["--branch", …]`; [Renovate](.github/renovate.json) opens PRs to bump them. ## First-time setup 1. Install chezmoi (for example `brew install chezmoi`). -2. Initialize from GitHub (clones into **`~/.local/share/chezmoi`** and writes **`~/.config/chezmoi/chezmoi.toml`**): +2. Initialize from GitHub (clones into **`~/.local/share/chezmoi`** and writes **`~/.config/chezmoi/chezmoi.toml`**). You will be prompted for git identity, GitHub username, and a **machine name** (defaults to hostname): ```bash chezmoi init --apply YOUR_GITHUB_USERNAME/dotfiles ``` -3. On **`chezmoi apply`**, chezmoi clones or updates externals under **`$(chezmoi source-path)`** (see `refreshPeriod` in `.chezmoiexternal.toml`; **`0`** means no periodic `git pull`—use **`chezmoi apply --refresh-externals`** when you want to update plugins). +3. On **`chezmoi apply`**, chezmoi downloads or updates externals under **`$(chezmoi source-path)`** (see `refreshPeriod` in `.chezmoiexternal.toml`; **`0`** means no periodic refresh—use **`chezmoi apply --refresh-externals`** when you want to update plugins). 4. Set Fish as the login shell (after `brew install fish` or your distro package), then: @@ -35,10 +35,41 @@ chezmoi apply --refresh-externals Or your usual **`dfu`** alias if it wraps the same steps. +## Dependency monitoring + +1. **Enable [Renovate](https://github.com/apps/renovate)** on this repository (uses [`.github/renovate.json`](.github/renovate.json)). + - Bumps pinned chezmoi **git-repo** branch pins in `.chezmoiexternal.toml`. + - Bumps `brew` / `cask` / `go` lines in `dot_Brewfile` via Repology and the Go module index. + - Bumps **GitHub Actions** in workflows. +2. **CI** ([`.github/workflows/dependency-audit.yml`](.github/workflows/dependency-audit.yml)) runs weekly: + - Clones pinned externals at their configured branches and scans them with [OSV-Scanner](https://github.com/google/osv-scanner). + - On macOS, reports outdated Homebrew formulae/casks from `dot_Brewfile` in the job summary. +3. **Locally** after `chezmoi apply --refresh-externals`, inspect checked-out plugin trees: + ```bash + for d in ~/.vim/pack/vendor/start/* ~/.zsh/plugins/* ~/.shell/plugins/*; do + [ -d "$d" ] && echo "$d" + done + ``` + ## Layout notes -- **Fish** (`dot_config/fish/`): `conf.d/` snippets (PATH from **`00-chezmoi-path.fish.tmpl`**, env, abbreviations, dircolors, Catppuccin theme, vi bindings, secrets) and **`functions/`** for `dfu`, `load_secret`, `cdgr`, `up`, helpers, plus **`fish_prompt`** / **`fish_right_prompt`** (cwd + `USER at <~/.name>` + `fish_git_prompt`). Not ported from zsh: async right-prompt, `tog` / `vshow` / `vmultiline`. -- **Vim externals** ([`.chezmoiexternal.toml`](.chezmoiexternal.toml)): [vim-polyglot](https://github.com/sheerun/vim-polyglot) for bundled syntax; [vim-go](https://github.com/fatih/vim-go) with **`g:polyglot_disabled = ['go']`** in `dot_vimrc` so Go stays on vim-go. Separate trees for [preservim/nerdtree](https://github.com/preservim/nerdtree), [lightline.vim](https://github.com/itchyny/lightline.vim), [material.vim](https://github.com/kaicataldo/material.vim), [incsearch.vim](https://github.com/haya14busa/incsearch.vim). Dircolors: [nordtheme/dircolors](https://github.com/nordtheme/dircolors) under `~/.shell/plugins/nord-dircolors/`. -- **`dot_zshrc.tmpl`**: main zsh init (PATH, Homebrew on macOS, shared `~/.shell` and `~/.zsh` bits). Optional **`~/.zshrc.local`** is sourced last for machine-only overrides (not in this repo). +- **Fish** (`dot_config/fish/`): primary shell. Modular `conf.d/` snippets: + - **`00-path.fish.tmpl`** — Homebrew (macOS/Linuxbrew), Go/Rust/chezmoi bin paths, `~/.bin`, `~/.local/bin`, `~/bin` + - **`10-shell-env.fish`** — PIP/Python env mirrors `~/.shell/external.sh` + - **`20-abbreviations.fish`** — cloud/IaC abbreviations, `ls`/`grep` aliases + - **`40-theme.fish`** — Catppuccin Macchiato via `fish_config theme` + - **`50-editor-history.fish`** — `EDITOR=vim`, vi key bindings, large history + - **`55-git-prompt.fish`** — `fish_git_prompt` color/state variables (used by `fish_right_prompt`) + - **`60-secrets.fish`** — `load_secret GEMINI_API_KEY` + - **`functions/`** — `dfu`, `load_secret`, `mcd`, `peek`, `up`, `cdgr`, `fpr`, `serve`, `jump`, `xin`, `nonascii`, `syspip` / `syspip3` + - **`fish_prompt`** / **`fish_right_prompt`** — cwd + `USER at <~/.name>` + `fish_git_prompt` (aligned with zsh/tmux) + - Helpers still **zsh-only** via `~/.shell/aliases.sh`: `syspip2`, screen `cd` hack, `tog` / `vshow` / `vmultiline`. + - **Dircolors** (nord) is configured for **zsh only** (`zsh/plugins_after.zsh`), not Fish. +- **Zsh** (`dot_zshrc.tmpl`, `~/.zsh` symlink): legacy/compatibility shell. Sources `~/.shell/{functions,external,aliases}.sh` and `~/.zsh/{settings,prompt,plugins_*}.sh`. Optional **`~/.zshrc.local`** for machine-only overrides. +- **Vim / Zsh / shell externals** ([`.chezmoiexternal.toml`](.chezmoiexternal.toml)): pinned **git-repo** clones for [vim-polyglot](https://github.com/sheerun/vim-polyglot), [vim-go](https://github.com/fatih/vim-go) (`g:polyglot_disabled = ['go']` in `dot_vimrc`), [preservim/nerdtree](https://github.com/preservim/nerdtree), [lightline.vim](https://github.com/itchyny/lightline.vim), [material.vim](https://github.com/kaicataldo/material.vim), [incsearch.vim](https://github.com/haya14busa/incsearch.vim), zsh plugins, and [nordtheme/dircolors](https://github.com/nordtheme/dircolors) under `~/.shell/plugins/nord-dircolors/`. +- **Bin scripts** (`dot_bin/` → `~/.bin/`): `tmx`, `git-diff-changes`. +- **`dot_name.tmpl`** → `~/.name`: human-readable machine name (prompted at `chezmoi init`, default hostname). Used by tmux status bar and Fish/zsh prompts. +- **`dot_tmux.conf`**: Catppuccin Macchiato theme; status bar shows `@machine_name` from `~/.name`. - **`dot_hammerspoon/`** is skipped on non-macOS via **`.chezmoiignore.tmpl`**. -- **`dotfiles-local/`** is ignored until removed locally. +- **Brewfiles**: `dot_Brewfile` → `~/.Brewfile` (full macOS bundle, applied by `run_onchange_install-packages.sh.tmpl` on Darwin). Root `Brewfile` is a smaller reference set, not deployed by chezmoi. +- **Local overrides**: `~/.config/fish/config.local.fish`, `~/.zshrc.local`, `~/.tmux_local.conf`, `~/.gitconfig_local` (templated at init). diff --git a/dot_config/fish/conf.d/00-path.fish.tmpl b/dot_config/fish/conf.d/00-path.fish.tmpl index 272e17d..3c22fb2 100644 --- a/dot_config/fish/conf.d/00-path.fish.tmpl +++ b/dot_config/fish/conf.d/00-path.fish.tmpl @@ -35,6 +35,7 @@ if command -q chezmoi end end -# --- PERSONAL USER BINARIES +# --- PERSONAL USER BINARIES (chezmoi dot_bin → ~/.bin) +fish_add_path -g -p $HOME/.bin fish_add_path -g -p $HOME/.local/bin fish_add_path -g -p $HOME/bin \ No newline at end of file diff --git a/dot_config/fish/functions/_machine_name.fish b/dot_config/fish/functions/_machine_name.fish new file mode 100644 index 0000000..031fcc3 --- /dev/null +++ b/dot_config/fish/functions/_machine_name.fish @@ -0,0 +1,7 @@ +function _machine_name + if test -f $HOME/.name + cat $HOME/.name + else + hostname -s + end +end diff --git a/dot_config/fish/functions/cdgr.fish b/dot_config/fish/functions/cdgr.fish new file mode 100644 index 0000000..6636e67 --- /dev/null +++ b/dot_config/fish/functions/cdgr.fish @@ -0,0 +1,3 @@ +function cdgr + cd (git root) +end diff --git a/dot_config/fish/functions/fish_prompt.fish b/dot_config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..26d2b06 --- /dev/null +++ b/dot_config/fish/functions/fish_prompt.fish @@ -0,0 +1,15 @@ +function fish_prompt + set -l cmd_status $status + + echo -n (set_color green)(prompt_pwd)(set_color normal)' ' + + if test $cmd_status -ne 0 + echo -n (set_color red)'!'(set_color normal)' ' + end + + if test (id -u) -eq 0 + echo -n (set_color red)'>'(set_color normal)' ' + else + echo -n (set_color magenta)'>'(set_color normal)' ' + end +end diff --git a/dot_config/fish/functions/fish_right_prompt.fish b/dot_config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..fc0eead --- /dev/null +++ b/dot_config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,12 @@ +function fish_right_prompt + if test (id -u) -eq 0 + echo -n (set_color red)(whoami)(set_color normal) + else + echo -n (set_color magenta)(whoami)(set_color normal) + end + + echo -n (set_color blue)' at '(set_color normal) + echo -n (set_color cyan)(_machine_name)(set_color normal)' ' + + fish_git_prompt +end diff --git a/dot_config/fish/functions/fpr.fish b/dot_config/fish/functions/fpr.fish new file mode 100644 index 0000000..02220dd --- /dev/null +++ b/dot_config/fish/functions/fpr.fish @@ -0,0 +1,25 @@ +function fpr + if not git rev-parse --git-dir >/dev/null 2>&1 + echo 'error: fpr must be executed from within a git repository' >&2 + return 1 + end + + cdgr; or return + + set -l repo user branch + switch (count $argv) + case 2 + set repo (basename $PWD) + set user $argv[1] + set branch $argv[2] + case 3 + set repo $argv[1] + set user $argv[2] + set branch $argv[3] + case '*' + echo 'Usage: fpr [repo] username branch' >&2 + return 1 + end + + git fetch git@github.com:$user/$repo $branch:$user/$branch +end diff --git a/dot_config/fish/functions/jump.fish b/dot_config/fish/functions/jump.fish new file mode 100644 index 0000000..ce90ec2 --- /dev/null +++ b/dot_config/fish/functions/jump.fish @@ -0,0 +1,3 @@ +function jump + cd (dirname $argv[1]) +end diff --git a/dot_config/fish/functions/nonascii.fish b/dot_config/fish/functions/nonascii.fish new file mode 100644 index 0000000..eb1a911 --- /dev/null +++ b/dot_config/fish/functions/nonascii.fish @@ -0,0 +1,3 @@ +function nonascii + env LC_ALL=C grep -n '[^[:print:][:space:]]' $argv[1] +end diff --git a/dot_config/fish/functions/serve.fish b/dot_config/fish/functions/serve.fish new file mode 100644 index 0000000..e660236 --- /dev/null +++ b/dot_config/fish/functions/serve.fish @@ -0,0 +1,5 @@ +function serve + set -l port 8080 + test (count $argv) -ge 1; and set port $argv[1] + ruby -run -e httpd . -p $port +end diff --git a/dot_config/fish/functions/syspip.fish b/dot_config/fish/functions/syspip.fish new file mode 100644 index 0000000..2e129af --- /dev/null +++ b/dot_config/fish/functions/syspip.fish @@ -0,0 +1,7 @@ +function syspip + env PIP_REQUIRE_VIRTUALENV= pip $argv +end + +function syspip3 + env PIP_REQUIRE_VIRTUALENV= pip3 $argv +end diff --git a/dot_config/fish/functions/xin.fish b/dot_config/fish/functions/xin.fish new file mode 100644 index 0000000..cf3f4cc --- /dev/null +++ b/dot_config/fish/functions/xin.fish @@ -0,0 +1,5 @@ +function xin + cd $argv[1]; or return + set -e argv[1] + command $argv +end diff --git a/dot_name.tmpl b/dot_name.tmpl index 128df65..98e974a 100644 --- a/dot_name.tmpl +++ b/dot_name.tmpl @@ -1 +1 @@ -{{ .chezmoi.os }} +{{ (index . "machine_name") | default .chezmoi.hostname }} diff --git a/dot_tmux.conf b/dot_tmux.conf index 25c9862..7aaeea4 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf @@ -66,9 +66,12 @@ set -sg escape-time 0 # display pane numbers for longer set -g display-panes-time 2000 +# Machine name for status bar (resolved once when config is sourced) +set -g @machine_name "#(if [ -f $HOME/.name ]; then cat $HOME/.name; else hostname -s; fi)" + set -g status-left-length 20 -set -g status-left '#{?pane_input_off,#[fg=colour160],#[fg=colour136]}[#[fg=colour136]#S:#I.#P#{?pane_input_off,#[fg=colour160],#[fg=colour136]}] ' -set -g status-right '#[fg=colour166]#([ "$(tmux show-option -g prefix)" != "prefix C-a" ] && echo "($(tmux show-option -g prefix | cut -c 8-)) ")#[fg=colour33]%d %b %Y #{?client_prefix,#[fg=colour160],#[fg=colour61]}- #[fg=colour64]%I:%M %p #{?client_prefix,#[fg=colour160],#[fg=colour61]}- #[fg=colour37]#([ -f $HOME/.name ] && cat $HOME/.name || hostname)' +set -g status-left '#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}[#[fg=#f5a97f]#S:#I.#P#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}] ' +set -g status-right '#[fg=#f5a97f]#{?client_prefix,#[fg=#ed8796],} %d %b %Y #[fg=#8aadf4]%I:%M %p #[fg=#a5adcb]#{@machine_name}' # increase scrollback lines set -g history-limit 65536 @@ -90,22 +93,22 @@ bind P if-shell "[ \"$(tmux show-options -g prefix)\" = \"prefix C-a\" ]" '\ set -g prefix C-a; display-message "passthrough disabled"; refresh-client -S; \ ' -#### color (Solarized 256) -set -g status-style bg=colour235,fg=colour136 -setw -g window-status-style fg=colour244 -setw -g window-status-current-style fg=colour166 -setw -g window-status-activity-style fg=colour61 -setw -g window-status-bell-style fg=colour61 -set -g pane-border-style fg=colour235 -set -g pane-active-border-style fg=colour240 -set -g message-style bg=colour235,fg=colour166 +#### color (Catppuccin Macchiato) +set -g status-style bg=#24273a,fg=#cad3f5 +setw -g window-status-style fg=#a5adcb +setw -g window-status-current-style fg=#f5a97f +setw -g window-status-activity-style fg=#8aadf4 +setw -g window-status-bell-style fg=#c6a0f6 +set -g pane-border-style fg=#363a4f +set -g pane-active-border-style fg=#5b6078 +set -g message-style bg=#24273a,fg=#f5a97f # pane number display -set -g display-panes-active-colour colour166 #blue -set -g display-panes-colour colour33 #orange +set -g display-panes-active-colour #f5a97f +set -g display-panes-colour #8aadf4 # clock -setw -g clock-mode-colour colour64 #green +setw -g clock-mode-colour #a6da95 # Allow local customization in ~/.tmux_local.conf if-shell "[ -f ~/.tmux_local.conf ]" 'source ~/.tmux_local.conf' \ No newline at end of file From 68c68d7528deaf373833e2d8e3bd6cc5d1b30ea7 Mon Sep 17 00:00:00 2001 From: CI User Date: Thu, 9 Jul 2026 16:34:59 +0000 Subject: [PATCH 2/3] Fix CI: reliable chezmoi install and branch pins for untagged externals lightline.vim and material.vim have no release tags; pin to master/main instead of commit SHAs so git clone --branch works in CI and chezmoi apply. Install chezmoi from GitHub releases with retries instead of get.chezmoi.io to avoid intermittent 504 errors. Co-authored-by: Huy Pham --- .chezmoiexternal.toml | 4 ++-- .github/workflows/chezmoi.yml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml index 982ca48..d11c5f9 100644 --- a/.chezmoiexternal.toml +++ b/.chezmoiexternal.toml @@ -7,7 +7,7 @@ type = "git-repo" url = "https://github.com/itchyny/lightline.vim" refreshPeriod = "0" [".vim/pack/vendor/start/lightline.vim".clone] -args = ["--branch", "d042c506cb2e7a59112a72447e0b5fe8739d9d1d", "--depth", "1"] +args = ["--branch", "master", "--depth", "1"] [".vim/pack/vendor/start/lightline.vim".pull] args = ["--ff-only"] @@ -43,7 +43,7 @@ type = "git-repo" url = "https://github.com/kaicataldo/material.vim.git" refreshPeriod = "0" [".vim/pack/vendor/start/material.vim".clone] -args = ["--branch", "32f423c825ee89a37d66e3d8f00e777c7d8a41ab", "--depth", "1"] +args = ["--branch", "main", "--depth", "1"] [".vim/pack/vendor/start/material.vim".pull] args = ["--ff-only"] diff --git a/.github/workflows/chezmoi.yml b/.github/workflows/chezmoi.yml index cd5467b..cc4ed96 100644 --- a/.github/workflows/chezmoi.yml +++ b/.github/workflows/chezmoi.yml @@ -17,7 +17,19 @@ jobs: - name: Install chezmoi run: | - sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin" "$CHEZMOI_VERSION" + mkdir -p "$HOME/.local/bin" + version="${CHEZMOI_VERSION#v}" + for attempt in 1 2 3; do + if curl -fsSL \ + "https://github.com/twpayne/chezmoi/releases/download/v${version}/chezmoi_${version}_linux_amd64.tar.gz" \ + -o /tmp/chezmoi.tar.gz; then + tar -xzf /tmp/chezmoi.tar.gz -C "$HOME/.local/bin" chezmoi + chmod +x "$HOME/.local/bin/chezmoi" + break + fi + sleep $((attempt * 5)) + done + "$HOME/.local/bin/chezmoi" --version echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Write test chezmoi config From 2269163974e85fee5b50dce8e8099c39ad047618 Mon Sep 17 00:00:00 2001 From: CI User Date: Thu, 9 Jul 2026 16:40:13 +0000 Subject: [PATCH 3/3] Make OSV externals scan tolerate vim plugin repos without lockfiles Prune test-fixtures before scanning to avoid vim-go stdlib noise. Treat osv-scanner exit 128 (no package sources) as success. Co-authored-by: Huy Pham --- .github/workflows/dependency-audit.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-audit.yml b/.github/workflows/dependency-audit.yml index c6ff978..8cd1ddc 100644 --- a/.github/workflows/dependency-audit.yml +++ b/.github/workflows/dependency-audit.yml @@ -53,7 +53,19 @@ jobs: PY - name: Scan externals with OSV - run: osv-scanner scan source --recursive /tmp/dotfiles-externals + run: | + # Drop test-only trees (e.g. vim-go fixtures) that produce stdlib noise. + find /tmp/dotfiles-externals -type d \( -name test-fixtures -o -name testdata -o -name tests \) -print0 \ + | xargs -0 rm -rf + set +e + osv-scanner scan source --recursive /tmp/dotfiles-externals + code=$? + set -e + if [ "$code" -eq 128 ]; then + echo "No package manifests in externals; scan skipped." + exit 0 + fi + exit "$code" brew-outdated-report: runs-on: macos-latest