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

Re: zsh-newuser-install

On Apr 26,  2:10pm, Bart Schaefer wrote:
} Here's an idea:  Let's collect some default completion zstyles and put
} them in a file in $fpath, named so that compinit arranges for it to be
} autoloaded the same way it picks up completers etc.

Silly me, I forgot about "compinstall":

If the system was installed completely, it should be enough to call the
shell function compinit from your initialization file; see the next
section.  However, the function compinstall can be run by a user to
configure various aspects of the completion system.

Usually, compinstall will insert code into .zshrc, although if that is
not writable it will save it in another file and tell you that file's
location.  Note that it is up to you to make sure that the lines added
to .zshrc are actually run; you may, for example, need to move them to
an earlier place in the file if .zshrc usually returns early.  So long
as you keep them all together (including the comment lines at the start
and finish), you can rerun compinstall and it will correctly locate and
modify these lines.  Note, however, that any code you add to this
section by hand is likely to be lost if you rerun compinstall, although
lines using the command `zstyle' should be gracefully handled.

The new code will take effect next time you start the shell, or run
.zshrc by hand; there is also an option to make them take effect
immediately.  However, if compinstall has removed definitions, you will
need to restart the shell to see the changes.

To run compinstall you will need to make sure it is in a directory
mentioned in your fpath parameter, which should already be the case if
zsh was properly configured as long as your startup files do not remove
the appropriate directories from fpath.  Then it must be autoloaded
(`autoload -U compinstall' is recommended).  You can abort the
installation any time you are being prompted for information, and your
.zshrc will not be altered at all; changes only take place right at the
end, where you are specifically asked for confirmation.

compinit arranges to autoload compinstall, so you can always run it if
you have the completion system loaded.

However, that doesn't mean it's a bad idea to have an additional file
of defaults that are easily overridden by the user or local admin.
I suggest calling it "compdefaults" and autoloading it at the same
point in compinit where compinstall et al. are autoloaded.

Then the question is when to run it.

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