Skip to content

Should fzf shell integration be initialised before or after calling compinit ? #3981

Answered by LangLangBart
xd003 asked this question in Q&A
Discussion options

You must be logged in to vote

fzf doesn't rely on the default zsh's completion system that is initialised when you call compinit12. Therefore, placing it before or after compinit should not matter.

Example: Setting up fzf completion without calling autoload -Uz compinit && compinit results in no issues.

# minimal zsh environment
command env -i HOME=$HOME TERM=$TERM USER=$USER LANG=en_US.UTF-8 PATH=$PATH /usr/local/bin/zsh -f
source <(fzf --zsh)
# the FZF_COMPLETION_TRIGGER is by default set to '**'
ls **<TAB>

However, in the zsh setup files I've observed, it is placed after autoload -U compinit && compinit, not because it's necessary, but to ensure default user configurations are initialized first. This allows third-p…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xd003
Comment options

Answer selected by xd003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants