Skip to content

Zsh

The rootbeer.shells.zsh module provides a declarative way to generate zsh configuration from a Lua table.

Example

lua
local zsh = require("rootbeer.shells.zsh")

rb.file("~/.zshrc", zsh.config({
  env = {
    EDITOR = "nvim",
    PATH = "$HOME/.local/bin:$PATH",
  },
  aliases = {
    ll = "ls -la",
    gs = "git status",
  },
  evals = {
    "mise activate zsh",
  },
  sources = {
    "$HOME/.config/zsh/plugins.zsh",
  },
  extra = "bindkey -v",
}))

API Reference

config(cfg)

Renders a declarative zsh config table into a string.

cfg zsh.Config — The configuration table.

NameTypeDescription
env (optional)table<string, string>Environment variables exported via export KEY="value".
aliases (optional)table<string, string>Shell aliases defined via alias name="command".
evals (optional)string[]Commands wrapped in eval "$(cmd)".
sources (optional)string[]File paths to source via source path.
extra (optional)string|string[]Raw lines appended as-is to the output.

Returns:

  • string — The rendered zshrc content.