nixos/programs/fish: add shellAbbrs config

This commit is contained in:
figsoda 2021-04-14 17:46:27 -04:00 committed by Cole Helbling
parent a64b9f2b10
commit 2f6a9bb297

View file

@ -8,6 +8,11 @@ let
cfg = config.programs.fish;
fishAbbrs = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "abbr -ag ${k} ${escapeShellArg v}")
cfg.shellAbbrs
);
fishAliases = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}")
(filterAttrs (k: v: v != null) cfg.shellAliases)
@ -83,6 +88,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 = {};
description = ''
@ -205,6 +222,7 @@ in
# if we haven't sourced the interactive config, do it
status --is-interactive; and not set -q __fish_nixos_interactive_config_sourced
and begin
${fishAbbrs}
${fishAliases}
${sourceEnv "interactiveShellInit"}