mirror of
https://github.com/nix-community/home-manager
synced 2024-12-02 16:09:46 +01:00
zsh: fix completion when oh-my-zsh is enabled
enableCompletion option not only calls compinit but also adds
nix-zsh-completions package to home.packages which should still happen
even if oh-my-zsh is enabled.
The double compinit call will still be eliminated by moving guarding condition
down to the compinit call itself.
Fixes #771.
(cherry picked from commit 7310cfc557
)
This commit is contained in:
parent
ef906c5a92
commit
45a73067ac
1 changed files with 7 additions and 6 deletions
|
@ -338,7 +338,13 @@ in
|
||||||
fpath+="$HOME/${pluginsDir}/${plugin.name}"
|
fpath+="$HOME/${pluginsDir}/${plugin.name}"
|
||||||
'') cfg.plugins)}
|
'') cfg.plugins)}
|
||||||
|
|
||||||
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
|
# Oh-My-Zsh calls compinit during initialization,
|
||||||
|
# calling it twice causes sight start up slowdown
|
||||||
|
# as all $fpath entries will be traversed again.
|
||||||
|
${optionalString (cfg.enableCompletion && !cfg.oh-my-zsh.enable)
|
||||||
|
"autoload -U compinit && compinit"
|
||||||
|
}
|
||||||
|
|
||||||
${optionalString cfg.enableAutosuggestions
|
${optionalString cfg.enableAutosuggestions
|
||||||
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||||
}
|
}
|
||||||
|
@ -387,11 +393,6 @@ in
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.oh-my-zsh.enable {
|
(mkIf cfg.oh-my-zsh.enable {
|
||||||
# Oh-My-Zsh calls compinit during initialization,
|
|
||||||
# calling it twice causes sight start up slowdown
|
|
||||||
# as all $fpath entries will be traversed again.
|
|
||||||
programs.zsh.enableCompletion = mkForce false;
|
|
||||||
|
|
||||||
# Make sure we create a cache directory since some plugins expect it to exist
|
# Make sure we create a cache directory since some plugins expect it to exist
|
||||||
# See: https://github.com/rycee/home-manager/issues/761
|
# See: https://github.com/rycee/home-manager/issues/761
|
||||||
home.file."${config.xdg.cacheHome}/oh-my-zsh/.keep".text = "";
|
home.file."${config.xdg.cacheHome}/oh-my-zsh/.keep".text = "";
|
||||||
|
|
Loading…
Reference in a new issue