Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: detect if compinit was run and rerun



On Fri, 1 Jun 2018 16:58:19 +0200
Paul Seyfert <pseyfert.mathphys@xxxxxxxxx> wrote:
> I am therefore wondering if I can detect if `compinit` has already
> been called and rerun it if so.

if (( ${+_comps} )): then
  ...
fi

should be good enough in the vast majority of cases.  _comps is only
setup within compinit or by compdef which isn't defined until compinit
runs.  So this only fails if the user is doing something very personal
best kept to the privacy of their own home.

pws



Messages sorted by: Reverse Date, Date, Thread, Author