Dear all, We are working on a small script that is supposed to be sourced to set up some environment for a user. I.e. it mostly prepends to PATH, LD_LIBRARY_PATH, MANPATH, PYTHONPATH, CMAKE_PREFIX_PATH. For the additional commands, we would also like to provide tab completions. The plan is atm to have them all in one directory which would be prepended (appended?) to $fpath. As far as I see, manipulating $fpath doesn't change the completion behaviour until `compinit` is run. As far as I know it corresponds the zsh design to not force completion on the user unless they ask for it, therefore I don't want to blindly run compinit in the script (if a user does not call `compinit`, I don't do it for them). On the other hand I don't want to annoy users with "yes, you already called `compinit` in your .zshrc, but you need to do it again". I am therefore wondering if I can detect if `compinit` has already been called and rerun it if so. Do you have suggestions how to approach this? I drafted: ( compdef ) ; [ $? != 127 ] && compinit ; Ideally I would reuse its settings. I.e. if a user ran `compinit` with -i or -C originally, our script shouldn't run `compinit` w/o. Thanks, Paul
Attachment:
signature.asc
Description: PGP signature