From 6f24595362421412d2cf18155f10059db37497ae Mon Sep 17 00:00:00 2001 From: Elliot Date: Mon, 11 Aug 2025 13:48:48 +0800 Subject: [PATCH] fish: add shellAbbrs config Co-authored-by: Sam <30577766+Samasaur1@users.noreply.github.com> --- modules/programs/fish.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 65797cc..de6163e 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -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"}