From 9e01441c5c1111cfd6f1d021c742949760f29d4f Mon Sep 17 00:00:00 2001 From: Ashish SHUKLA Date: Tue, 27 Oct 2020 17:16:26 +0530 Subject: [PATCH] zsh: Add dirHashes option --- modules/programs/zsh.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 362daa3c0..efe2946c4 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -22,6 +22,10 @@ let mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases ); + dirHashesStr = concatStringsSep "\n" ( + mapAttrsToList (k: v: ''hash -d ${k}="${v}"'') cfg.dirHashes + ); + zdotdir = "$HOME/" + cfg.dotDir; bindkeyCommands = { @@ -234,6 +238,21 @@ in type = types.attrsOf types.str; }; + dirHashes = mkOption { + default = {}; + example = literalExample '' + { + docs = "$HOME/Documents"; + vids = "$HOME/Videos"; + dl = "$HOME/Downloads"; + } + ''; + description = '' + An attribute set that adds to named directory hash table. + ''; + type = types.attrsOf types.str; + }; + enableCompletion = mkOption { default = true; description = '' @@ -488,6 +507,9 @@ in # Global Aliases ${globalAliasesStr} + + # Named Directory Hashes + ${dirHashesStr} ''; }