# install zinit
if ! source "$ZDOTDIR/zinit.zsh"; then
    print -u2 "zinit: failed to initialize; skipping plugin configuration"
    return 1
fi

zinit light zdharma-continuum/zinit-annex-bin-gem-node
zinit light zdharma-continuum/zinit-annex-binary-symlink

zinit wait lucid light-mode id-as depth'1' for \
    wintermi/zsh-brew \
    hlissner/zsh-autopair \
    Aloxaf/fzf-tab \
    atinit'zicompinit; zicdreplay -q' \
        zdharma-continuum/fast-syntax-highlighting \
    atload'_zsh_autosuggest_start' \
        zsh-users/zsh-autosuggestions

zinit id-as from'gh-r' lbin'!' completions for \
    lsd-rs/lsd \
    micro-editor/micro \
    mv'**/bat.zsh -> _bat' \
        @sharkdp/bat

zinit for \
    id-as \
    as'completion' \
    from'gh-r' \
    mv'**/_fastfetch -> _fastfetch' \
    atpull'%atclone' \
    lbin'!**bin/fastfetch -> fastfetch' \
    @fastfetch-cli/fastfetch

zinit for \
    id-as \
    from'gh-r' \
    atclone'./zoxide init zsh > init.zsh' \
    atpull'%atclone' \
    lbin'!' \
    @ajeetdsouza/zoxide

zinit for \
    id-as \
    from'gh-r' \
    atclone'
        VP_SELF_SETUP_NO_MODIFY_PATH=1 ./vp env setup --refresh > /dev/null; \
        ./vp env on > /dev/null; \
        VP_COMPLETE=zsh "$XDG_DATA_HOME/vite-plus/bin/vp" > init.zsh;
    ' \
    atpull'%atclone' \
    atload'source "$XDG_CONFIG_HOME/vite-plus/env"' \
    @voidzero-dev/vite-plus

zinit for \
    id-as \
    from'gh-r' \
    atclone'
        ./starship init zsh > init.zsh; \
        ./starship completions zsh > _starship;
    ' \
    atpull'%atclone' \
    sbin'starship' \
    @starship/starship

zinit for \
    id-as \
    from'gh-r' \
    atclone'./fzf --zsh > init.zsh' \
    atpull'%atclone' \
    lbin'!fzf' \
    @junegunn/fzf

for script in $ZDOTDIR/config/*.zsh; do
    source "$script"
done
