]> arthur.barton.de Git - ax-zsh.git/commitdiff
50_completion: Try to find all available completion functions
authorAlexander Barton <alex@barton.de>
Mon, 22 Mar 2021 21:20:09 +0000 (22:20 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 22 Mar 2021 21:20:09 +0000 (22:20 +0100)
Try to add all folders possibly containing completion functions to the
fpath before calling compinit. See <https://github.com/ohmyzsh/ohmyzsh/issues/4614>
for a discussion of this topic, for example. It boils down to:

1. We have to call compinit early,
2. but plugins can add completions later, that won't be found ...

core/50_completion/50_completion.zshrc

index 53fe50b7b0e972ae26d8cf9f12290f65d3ba8e88..14dd03a095a8394e1d18196fc480d94083f06f24 100644 (file)
@@ -54,5 +54,15 @@ if [[ -z "$ZSH_COMPDUMP" ]]; then
        ZSH_COMPDUMP="$ZSH_CACHE_DIR/zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
 fi
 
+# Try to add all folders possibly containing completion functions to the fpath
+# before calling compinit. See <https://github.com/ohmyzsh/ohmyzsh/issues/4614>
+# for a discussion of this topic, for example. It boils down to:
+# - We have to call compinit early,
+# - but plugins can add completions later, that won't be found ...
+# (GENCOMPL_FPATH is used by RobSis/zsh-completion-generator)
+[[ -n "$GENCOMPL_FPATH" ]] && fpath+=($GENCOMPL_FPATH)
+fpath+=("$AXZSH/active_plugins/"*/completions(N))
+fpath+=("$AXZSH/active_plugins/"*/src(N))
+
 # Initialize ZSH completion system
 compinit -d "$ZSH_COMPDUMP"