Skip to content

Commit

Permalink
Eliminate zombie plugins, completions and themes
Browse files Browse the repository at this point in the history
We weren't claring `${ZGEN_COMPLETIONS}` and `${ZGEN_LOADED}` after
loading `${ZGEN_INIT}`. This made it impossible to delete a plugin -
every time I'd do `zgen save`, it would include them since they were
already in the arrays.

Closes tarjoilija#7
  • Loading branch information
unixorn committed Dec 23, 2014
1 parent 02fb8ea commit 541852e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zgen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,28 @@ zgen-save() {
rm "${ZGEN_INIT}"
fi

echo "#" >> "${ZGEN_INIT}"
echo "# Generated by zgen." >> "${ZGEN_INIT}"
echo "# This file will be overwritten the next time you run zgen save" >> "${ZGEN_INIT}"
echo "#" >> "${ZGEN_INIT}"
for file in "${ZGEN_LOADED[@]}"; do
echo "-zgen-source \"$file\"" >> "${ZGEN_INIT}"
done

# Set up fpath
echo >> "${ZGEN_INIT}"
echo "#" >> "${ZGEN_INIT}"
echo "# Add our plugins and completions to fpath">> "${ZGEN_INIT}"
echo "#" >> "${ZGEN_INIT}"
echo "fpath=(\$fpath $ZGEN_COMPLETIONS )" >> "${ZGEN_INIT}"

# Reset
echo >> "${ZGEN_INIT}"
echo "#" >> "${ZGEN_INIT}"
echo "# Clear ZGEN_LOADED and ZGEN_COMPLETIONS per #7">> "${ZGEN_INIT}"
echo "#" >> "${ZGEN_INIT}"
echo "ZGEN_LOADED=()" >> "${ZGEN_INIT}"
echo "ZGEN_COMPLETIONS=()" >> "${ZGEN_INIT}"
}

zgen-completions() {
Expand Down

0 comments on commit 541852e

Please sign in to comment.