refactor(fish): read the non-trivial snippets from files

Move the interactiveShellInit block and the copy function body into
modules/fish/*.fish and pull them in with builtins.readFile, so the
non-trivial fish lives in real fish files (highlighting, fish_indent)
instead of inline Nix strings. The Auto-loader only collects .nix, so
the new .fish files are ignored by it. Rendered config is unchanged.
This commit is contained in:
2026-07-18 18:34:42 -04:00
parent 9eb0fe797a
commit 16f29bd64a
3 changed files with 33 additions and 35 deletions

View File

@@ -111,44 +111,11 @@ in
copy = {
description = "Copy a file, or recursively copy a source directory into a destination";
body = ''
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
'';
body = builtins.readFile ./fish/copy.fish;
};
};
interactiveShellInit = ''
# vi-style modal editing on the command line.
set -g fish_key_bindings fish_vi_key_bindings
set -gx EDITOR nvim
set -gx VISUAL nvim
# Render man pages through bat.
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
end
# Apply fish-compatible profile overrides if present.
if test -f ~/.fish_profile
source ~/.fish_profile
end
'';
interactiveShellInit = builtins.readFile ./fish/interactive-init.fish;
};
};
};