zstyle
seems like it's just a central place to store and retrieve data, like an alternative to export
-ing shell parameters. Is that true, or is there more to it?
What does `zstyle` do
zsh
zsh
zstyle
seems like it's just a central place to store and retrieve data, like an alternative to export
-ing shell parameters. Is that true, or is there more to it?
Best Answer
zstyle
handles the obvious style control for the completion system, but it seems to cover more than just that. E.g., thevcs_info
module relies on it for display of git status in your prompt. You can start by looking at the few explanatory paragraphs inman zshmodules
in thezstyle
section.You can simply invoke it to see what settings are in effect. This can be instructive.
The Zsh Book has a nice chapter treatment on
zstyle
, also, explaining in detail its various fields.You could grep around in the
.../Completion/
directory on your system to see how some of those files make use ofzstyle
. A common location is near/usr/share/zsh/functions/Completion/*
. I see it used in 100+ files on my system there. Users often havezstyle
sprinkled around their~/.zshrc
, too. Here are some nice ones to add some color and descriptions to your completing:The completion system makes most of the fields clear if you play around with it. Try typing
zstyle :«tab»
and you see some options. Tab-complete to the next colon and you’ll see the next set of options, etc.