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>
This commit is contained in:
parent
68cc9eeb38
commit
de8463dd3e
3 changed files with 58 additions and 14 deletions
|
|
@ -7,6 +7,7 @@
|
|||
zsh-history-path-old-custom = ./history-path-old-custom.nix;
|
||||
zsh-history-path-old-default = ./history-path-old-default.nix;
|
||||
zsh-history-substring-search = ./history-substring-search.nix;
|
||||
zsh-plugins = ./plugins.nix;
|
||||
zsh-prezto = ./prezto.nix;
|
||||
zsh-session-variables = ./session-variables.nix;
|
||||
zsh-syntax-highlighting = ./syntax-highlighting.nix;
|
||||
|
|
|
|||
31
tests/modules/programs/zsh/plugins.nix
Normal file
31
tests/modules/programs/zsh/plugins.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ 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")$'
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue