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

Re: Rewrite of zsh-newuser-install

On Sat, Feb 13, 2021 at 2:27 AM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> Is there a list of which modules and their builtins get autoloaded? I cannot find this documented anywhere.


For example, the following means that the builtins ("b:") named
"limit", "ulimit", and "unlimit" are autoloaded when in zsh emulation

/* linked-in known module `zsh/rlimits' */
    char *zsh_features[] = {
    char *emu_features[] = {
    autofeatures("zsh", "zsh/rlimits",
       EMULATION(EMULATE_ZSH) ? zsh_features : emu_features,
       0, 1);

(Hmm, I see that the documentation for "zsh/param/private" is actually
incorrect, I changed "private" from an autoloaded builtin to a
reserved word and forgot to edit that paragraph.)

> Should we perhaps add a function that does that, to save the user from having to remember this? Something like this:
> zrestart() {
>   zsh -nf .zshrc && zsh -l && exit
> }
> Not sure about the name.

This is not a bad idea.  I agree about the naming difficulty, but
don't have a good suggestion.  "test_new_zshrc"?

> > > I already saw one error where add-zle-hook-widget
> > > failed, because zsh/zle wasn't loaded yet.
> [...] this was with the code copy-pasted directly into a .zshrc file. No zsh/newuser involved.

Hm.  zsh/zle is one of the default modules, it should always be there
unless the stdin is not a terminal.

> What about using ^Z for undo and ^[z for redo? That's similar to Cmd-Z for undo and Cmd-Shift-Z for redo in macOS.

That would be fine, I think.

> Although, I'm starting to think, given the amount of custom key bindings the new .zshrc includes by now, would it make more sense to introduce a completely new keymap in the C code?

This is possibly worth considering, but you're adding bindings in a
bunch of keymaps.

A compromise might be to have a second file that creates a keymap
using "bindkey" commands, and (optionally?) load + switch to that.  If
it goes well, then we can add it to the C later.

> Sure, but compinit actually checks the completer style to decide whether to rebind ^I to complete-word or leave it at expand-or-complete. So, then at least that style needs to come before compinit and then we have to zmodload zstyle before compinit anyway.

Again, no, the main shell should know from link time that any
reference to the ztyle command should pull in the zsh/zutil module.

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