diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 0e830215..525c8a6a 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 opt-programs.zsh.shellAliases, + 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} ''; }