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

Re: re-source rc atomically



On Jul 23,  6:42pm, 0x041F0x04300x04320x043B0x043E0x0432 0x041D0x04380 wrote:
}
} There is precmd_functions array. I do not know why each first advice
} suggests using precmd function in place of just adding an item to this
} array.

The array is a relatively recent addition to zsh, and it avoids a few
steps of explanation to refer directly to the precmd function.

} [The array] has two disadvantages regarding your case though:
}
} 1. You need to guard add against double inclusion if you want to be
} able to resource your zshrc.

Since we're moving past the "put this in precmd" shorthand ... that
problem can be avoided by using the add-zsh-hook utility.

    autoload -Uz add-zsh-hook
    add-zsh-hook precmd reload-zshrc

(assuming an appropriate reload-zshrc function was already defined).

-- 
Barton E. Schaefer



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