declare-zsh#
declare-zsh is a parser for
zinit
commands in .zshrc
. It allows to perform the following actions on
.zshrc
from the command-line:
- enable and disable selected plugins and snippets,
- add plugins and snippets,
- delete plugins and snippets.
In other words, by issuing a declzsh
command the user deploys a task of:
-
Reading and parsing of the
~/.zshrc
. -
Making changes (like removal of a plugin, i.e. of
zinit load {removed-plugin}
command together with the possible associatedzinit ice …
command) and then… -
Writing the result back to the
zshrc
(by default, the result is stored to~/.zshrc_gen
file for safety, but the author wants to emhasize very strongly, that breaking something within the parsedzshrc
is nearly impossible and the tool can be safely used with option-o ~/.zshrc
which pointsdeclzsh
to the originalzshrc
as the destination, output file).
Examples & Screenshots#
-
Example disabling of a plugin via the toggle option -TT – this works because the commands preceded by
:
are ignored by the shell: -
Example addition of a plugin via the option -AA – in order to also set up ice modifiers enclose them in a preceding square-bracket block, i.e.
declzsh -AA '[ wait"1" lucid ] zdharma-continuum/null'
: -
Example deletion of a plugin via the purge option -PP – the argument is treated as pattern, pass
*
to delete all plugins and snippets!:
Usage#
Multiple actions, i.e. multiple options like -AA
, -PP
, -DD
, etc. are
possible in a single declzsh
run.