From 5a89d4addbcd0e9a036dd2f80c71aaed7d1647e0 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 18 Jul 2026 18:45:06 -0400 Subject: [PATCH] refactor(fish): lay the Module out like ~/.config/fish Move the Module to modules/fish/fish.nix and mirror a real fish config directory beside it: config.fish (interactive init), conf.d/done.fish (the done plugin tuning, now a real conf.d file), and functions/copy.fish. completions/ and themes/ are omitted as they have no content and git cannot track empty directories. --- .claude/tasks/0005-fish-shell-module.md | 2 +- modules/fish/conf.d/done.fish | 3 +++ modules/fish/{interactive-init.fish => config.fish} | 4 ---- modules/{ => fish}/fish.nix | 7 +++++-- modules/fish/{ => functions}/copy.fish | 0 5 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 modules/fish/conf.d/done.fish rename modules/fish/{interactive-init.fish => config.fish} (74%) rename modules/{ => fish}/fish.nix (93%) rename modules/fish/{ => functions}/copy.fish (100%) diff --git a/.claude/tasks/0005-fish-shell-module.md b/.claude/tasks/0005-fish-shell-module.md index 389c425..136ac72 100644 --- a/.claude/tasks/0005-fish-shell-module.md +++ b/.claude/tasks/0005-fish-shell-module.md @@ -39,4 +39,4 @@ Configure the plugins natively through home-manager rather than a fish plugin ma - **Abbreviation-first.** Every non-eza alias is now a `shellAbbr` (the eza `ls` family stays an alias), `preferAbbrs = true`, and `generateCompletions = true` is pinned rather than left to the upstream default. - **vi command-line editing.** `interactiveShellInit` sets `fish_key_bindings fish_vi_key_bindings`; the `bang-bang` plugin re-binds `!`/`$` in insert mode via its own `--on-variable fish_key_bindings` handler, so the switch keeps them working. - **Trimmed aliases.** Navigation capped at four dots (`.....`/`......` dropped); `psmem`, `psmem10`, `dir`, `vdir`, and `please` removed. -- **Non-trivial fish read from files.** The `interactiveShellInit` block and the `copy` function body live in `modules/fish/interactive-init.fish` and `modules/fish/copy.fish`, pulled in with `builtins.readFile`, so the substantial fish is editable as real fish files. The trivial one-liners stay inline. The Auto-loader only collects `.nix`, so the `.fish` files are inert to it, and the rendered config is byte-for-byte identical to the inline version. +- **Module directory mirrors `~/.config/fish/`.** The Module lives at `modules/fish/fish.nix` with its hand-written fish laid out as in a real fish config: `config.fish` (interactive init, read into `interactiveShellInit`), `conf.d/done.fish` (the done plugin's tuning, placed as a real conf.d file via `xdg.configFile`), and `functions/copy.fish` (the non-trivial `copy` body, read into the `functions` option). Trivial one-liner functions stay inline in `fish.nix`. `completions/` and `themes/` are omitted because they have no content and git cannot track empty directories. The Auto-loader only collects `.nix`, so every `.fish` file is inert to it. diff --git a/modules/fish/conf.d/done.fish b/modules/fish/conf.d/done.fish new file mode 100644 index 0000000..ff0e81e --- /dev/null +++ b/modules/fish/conf.d/done.fish @@ -0,0 +1,3 @@ +# Tune the done plugin: only notify for commands past 10s, at low urgency. +set -g __done_min_cmd_duration 10000 +set -g __done_notification_urgency_level low diff --git a/modules/fish/interactive-init.fish b/modules/fish/config.fish similarity index 74% rename from modules/fish/interactive-init.fish rename to modules/fish/config.fish index 08d8b9e..ceb444a 100644 --- a/modules/fish/interactive-init.fish +++ b/modules/fish/config.fish @@ -8,10 +8,6 @@ set -gx VISUAL nvim set -x MANROFFOPT "-c" set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" -# Tune the done plugin: only notify for commands past 10s, at low urgency. -set -g __done_min_cmd_duration 10000 -set -g __done_notification_urgency_level low - # Prepend ~/.local/bin to PATH when it exists. if test -d ~/.local/bin fish_add_path ~/.local/bin diff --git a/modules/fish.nix b/modules/fish/fish.nix similarity index 93% rename from modules/fish.nix rename to modules/fish/fish.nix index 3b546b8..535c39b 100644 --- a/modules/fish.nix +++ b/modules/fish/fish.nix @@ -37,6 +37,9 @@ in wget # non-interactive HTTP downloader; backs the wget abbreviation ]; + # done's tuning lives in its own conf.d snippet, mirroring ~/.config/fish. + xdg.configFile."fish/conf.d/done.fish".source = ./conf.d/done.fish; + programs.fish = { enable = true; @@ -111,11 +114,11 @@ in copy = { description = "Copy a file, or recursively copy a source directory into a destination"; - body = builtins.readFile ./fish/copy.fish; + body = builtins.readFile ./functions/copy.fish; }; }; - interactiveShellInit = builtins.readFile ./fish/interactive-init.fish; + interactiveShellInit = builtins.readFile ./config.fish; }; }; }; diff --git a/modules/fish/copy.fish b/modules/fish/functions/copy.fish similarity index 100% rename from modules/fish/copy.fish rename to modules/fish/functions/copy.fish