diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 5199e51e9..ed65d5fe4 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -185,6 +185,14 @@ in type = types.nullOr types.bool; }; + cdpath = mkOption { + default = []; + description = '' + List of paths to autocomplete calls to `cd`. + ''; + type = types.listOf types.str; + }; + dotDir = mkOption { default = null; example = ".config/zsh"; @@ -392,6 +400,10 @@ in home.file."${relToDotDir ".zshrc"}".text = '' typeset -U path cdpath fpath manpath + ${optionalString (cfg.cdpath != []) '' + cdpath+=(${concatStringsSep " " cfg.cdpath}) + ''} + for profile in ''${(z)NIX_PROFILES}; do fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) done