zsh: Add dirHashes option

This commit is contained in:
Ashish SHUKLA 2020-10-27 17:16:26 +05:30 committed by Robert Helgesson
parent 9fe15dc83b
commit 9e01441c5c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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}
'';
}