1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-21 17:59:39 +01:00
home-manager/tests/modules/programs/zsh/plugins.nix
Austin Horstman de8463dd3e
zsh: add plugins.*.completions paths to fpath (#7197)
Autocompletion scripts and additional plugin functions are located in
specific directories that might not match the plugin source script but
need to be included in fpath before calling compinit.

An option to provide a path to these scripts is added to add the paths
to fpath before calling completionInit.

Co-authored-by: @zimeg <zim@o526.net>
2025-06-05 21:11:35 -05:00

31 lines
849 B
Nix

{ pkgs, ... }:
let
mockZshPluginSrc = pkgs.writeText "mockZshPluginSrc" "echo example";
in
{
config = {
programs.zsh = {
enable = true;
plugins = [
{
name = "mockPlugin";
file = "share/mockPlugin/mockPlugin.plugin.zsh";
src = mockZshPluginSrc;
completions = [
"share/zsh/site-functions"
"share/zsh/vendor-completions"
];
}
];
};
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^path+="$HOME/.zsh/plugins/mockPlugin"$'
assertFileRegex home-files/.zshrc '^fpath+="$HOME/.zsh/plugins/mockPlugin"$'
assertFileRegex home-files/.zshrc '^fpath+=("$HOME/.zsh/plugins/mockPlugin/share/zsh/site-functions" "$HOME/.zsh/plugins/mockPlugin/share/zsh/vendor-completions")$'
'';
};
}