zsh
The zsh module lets you describe your shell setup as one Lua table. Rootbeer turns it into the files zsh expects: environment, login profile, interactive settings, aliases, history, completions, and startup commands.
local zsh = require("rootbeer.zsh")Configure zsh
Start with the settings you would normally spread across .zshenv, .zprofile, and .zshrc:
zsh.config({
keybind_mode = "emacs",
options = { "CORRECT", "EXTENDED_GLOB" },
env = {
EDITOR = "nvim",
VISUAL = "$EDITOR",
},
aliases = {
g = "git",
ls = "lsd -l --group-directories-first",
},
history = { size = 10000 },
evals = { "mise activate zsh" },
})Rootbeer manages your Zsh startup files through ~/.zshenv and makes installed packages available in login shells. Zsh must already be installed; after rb apply, run zsh -l to start it with your settings.
For machine-specific values like work-only aliases or a different EDITOR, use Profiles.
API Reference
zsh.config(cfg)
Applies the full zsh configuration. Generates ~/.zshenv (bootstrap), <dir>/.zshenv, <dir>/.zprofile, and <dir>/.zshrc from a single config table.
Parameters — cfg: zsh.Config
aliasestable<string, string>optionalalias name="command".dirstringoptional"~/.config/zsh". All zsh files are written here and a bootstrap ~/.zshenv is created to set ZDOTDIR.envtable<string, string>optional.zshenv (available in all shells).evalsstring[]optionaleval "$(cmd)".extrastring|string[]optionalfunctionstable<string, string>optional[[...]] strings.hookstable<string, string|string[]>optionaladd-zsh-hook. Keys are hook names (e.g. "precmd"), values are function names or lists of function names.keybind_mode"emacs"|"vi"optionalset -o emacs or set -o vi).keybindingstable<string, string>optionalbindkey mappings (e.g. { ["^R"] = "my-widget" }).optionsstring[]optionalsetopt options (e.g. "CORRECT", "EXTENDED_GLOB")..zprofile. Rootbeer's package profile environment is sourced automatically.promptstringoptionalPS1 prompt string.sourcesstring[]optionalvariablestable<string, string>optionalvcs_info. When true, uses default format " (%b)". Automatically sets PROMPT_SUBST, adds a precmd hook, and autoloads vcs_info.widgetsstring[]optionalzle -N. The function must be defined in functions.zsh.CompletionConfig
cachestringoptionalenablebooleanoptionalcompinit. Defaults to true.menu_selectbooleanoptionaltrue.stylestable<string, string>optionalzstyle entries (pattern → value).vi_navbooleanoptionalfalse.zsh.HistoryConfig
appendbooleanoptionaltrue.dedupbooleanoptionaltrue.filestringoptionalHISTFILE path. Defaults to $ZDOTDIR/.zsh_history.ignorestringoptionalHISTIGNORE pattern.save_sizenumberoptionalSAVEHIST. Defaults to size.sharebooleanoptionaltrue.sizenumberoptionalHISTSIZE. Defaults to 10000.zsh.ProfileConfig
evalsstring[]optionaleval "$(cmd)".extrastring|string[]optionalpath_appendstring[]optional$PATH.path_prependstring[]optional$PATH.sourcesstring[]optionalzsh.VcsInfoConfig
check_for_changesbooleanoptionaltrue.formatsstringoptionalvcs_info. Defaults to " (%b)".