feat: auto enable completion for zsh

Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
This commit is contained in:
Wenxuan Zhang 2024-02-06 11:22:40 +08:00
parent 63fd2ba998
commit 17f8815635
No known key found for this signature in database
GPG key ID: CCAF35548C65530F
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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