diff --git a/completions/git-forgit.zsh b/completions/git-forgit.zsh index 60f3f73..1dd653e 100644 --- a/completions/git-forgit.zsh +++ b/completions/git-forgit.zsh @@ -1,10 +1,5 @@ #!/bin/zsh -# # forgit completions for zsh plugin -# -# When using forgit via the shell plugin, place completions/_git-forgit in your -# $fpath (e.g. /usr/share/zsh/site-functions) and source this file after -# forgit.plugin.zsh to enable tab completion for shell functions and aliases. # Check if forgit plugin is loaded if (( $+functions[forgit::add] )); then diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index fecc3ad..e1b4866 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -11,6 +11,7 @@ if [[ -n "$ZSH_VERSION" ]]; then # shellcheck disable=2277,2296,2298 0="${${(M)0:#/*}:-$PWD/$0}" INSTALL_DIR="${0:h}" + fpath=("$INSTALL_DIR/completions" $fpath) elif [[ -n "$BASH_VERSION" ]]; then INSTALL_DIR="$(dirname -- "${BASH_SOURCE[0]}")" else @@ -175,3 +176,7 @@ if [[ -z "$FORGIT_NO_ALIASES" ]]; then alias "${forgit_blame}"='forgit::blame' fi + +if [[ -n "$ZSH_VERSION" ]]; then + source "$INSTALL_DIR/completions/git-forgit.zsh" +fi