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
1 changed files with 18 additions and 0 deletions

View File

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