fish: add shellAbbrs config

Co-authored-by: Sam <30577766+Samasaur1@users.noreply.github.com>
This commit is contained in:
Elliot 2025-08-11 13:48:48 +08:00
parent e04a388232
commit 6f24595362
No known key found for this signature in database

View file

@ -8,6 +8,10 @@ let
cfg = config.programs.fish;
fishAbbrs = concatStringsSep "\n" (
mapAttrsToList (k: v: "abbr -a ${k} -- ${escapeShellArg v}") cfg.shellAbbrs
);
fishAliases = concatStringsSep "\n" (
mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}")
(filterAttrs (k: v: v != null) cfg.shellAliases)
@ -101,6 +105,18 @@ in
'';
};
shellAbbrs = mkOption {
default = {};
example = {
gco = "git checkout";
npu = "nix-prefetch-url";
};
description = ''
Set of fish abbreviations.
'';
type = with types; attrsOf str;
};
shellAliases = mkOption {
default = config.environment.shellAliases;
description = ''
@ -217,6 +233,7 @@ in
# if we haven't sourced the interactive config, do it
status --is-interactive; and not set -q __fish_nix_darwin_interactive_config_sourced
and begin
${fishAbbrs}
${fishAliases}
${sourceEnv "interactiveShellInit"}