aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authordawidsowa <dawid_sowa@posteo.net>2020-07-20 19:54:30 +0200
committerGitHub <noreply@github.com>2020-07-20 19:54:30 +0200
commite2e8b7371ddfb896db412241a047366132c651f8 (patch)
tree9c60d1e26733850f3c45524c51fda2fa1df17b7d /modules
parent4bd0ca2cd793b3f057d114bd6a3183419f52ca49 (diff)
zsh: add shellGlobalAliases (#1381)
Diffstat (limited to 'modules')
-rw-r--r--modules/programs/zsh.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix
index 0e830215b96..525c8a6af85 100644
--- a/modules/programs/zsh.nix
+++ b/modules/programs/zsh.nix
@@ -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}
'';
}