sigoden / argc-completions

{bash,zsh,fish,powershell,nushell}-completions for 1000+ commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support $ZDOTDIR instead of $HOME

twnaing opened this issue · comments

ZSH manual states

There are five startup files that zsh will read commands from:

$ZDOTDIR/.zshenv
$ZDOTDIR/.zprofile
$ZDOTDIR/.zshrc
$ZDOTDIR/.zlogin
$ZDOTDIR/.zlogout

If ZDOTDIR is not set, then the value of HOME is used; this is the usual case.

So I think using ZDOTDIR will be better for compatibility.

The only place where zsh rcfile is used is ./scripts/setup-shell.sh zsh.

Please add the following code to '~/.zshrc'

~~~
# argc-completions
export ARGC_COMPLETIONS_ROOT="$HOME/.argc-completions"
export ARGC_COMPLETIONS_PATH="$ARGC_COMPLETIONS_ROOT/completions"
export PATH="$ARGC_COMPLETIONS_ROOT/bin:$PATH"
source <(ls -p -1 "$ARGC_COMPLETIONS_ROOT/completions" | sed -n 's/\.sh$//p' | xargs argc --argc-completions zsh)
~~~

Add the above code to '~/.zshrc'? (y/N): 

If your rcfile is not ~/.zshrc, then you can manually modify it. I don't want to introduce more complexity.

I did.

As the document says, users who do not have set ZDOTDIR will automatically fallback to HOME. So I thought using the ZDOTDIR will cover both type of users.