zsh: add shellGlobalAliases (#1381)

This commit is contained in:
dawidsowa 2020-07-20 19:54:30 +02:00 committed by GitHub
parent 4bd0ca2cd7
commit e2e8b7371d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,10 @@ let
mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases
);
globalAliasesStr = concatStringsSep "\n" (
mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases
);
zdotdir = "$HOME/" + cfg.dotDir;
bindkeyCommands = {
@ -207,6 +211,21 @@ in
type = types.attrsOf types.str;
};
shellGlobalAliases = mkOption {
default = {};
example = literalExample ''
{
UUID = "$(uuidgen | tr -d \\n)";
G = "| grep";
}
'';
description = ''
Similar to <varname><link linkend="opt-programs.zsh.shellAliases">opt-programs.zsh.shellAliases</link></varname>,
but are substituted anywhere on a line.
'';
type = types.attrsOf types.str;
};
enableCompletion = mkOption {
default = true;
description = ''
@ -451,6 +470,9 @@ in
# Aliases
${aliasesStr}
# Global Aliases
${globalAliasesStr}
'';
}