From e2e8b7371ddfb896db412241a047366132c651f8 Mon Sep 17 00:00:00 2001 From: dawidsowa Date: Mon, 20 Jul 2020 19:54:30 +0200 Subject: [PATCH] zsh: add shellGlobalAliases (#1381) --- modules/programs/zsh.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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} ''; }