Skip to content

Utils.Class.Config

sravioli edited this page Oct 27, 2024 · 2 revisions

Overview

This class allows you to create a new Wezterm configuration object.

Usage

-- this repo wezterm.lua
local Config = require("utils.class.config"):new()

require "events.update-status"
require "events.format-tab-title"
require "events.new-tab-button-click"
require "events.augment-command-palette"

return Config:add("config"):add "mappings"

Class Methods

:new()

Creates a new class instance. If wezterm.config_builder() is available it will use it and then enable strict mode to promote warning messages to error ones.

Returns

  • instance [Utils.Class.Config] - newly created class instance.

Usage

local Config = require("utils.class.config")
local config = Config:new()

:add(spec)

Extends the class instance with the given table. You can provide either a string (Lua require() path) or a table.

Parameters

  • spec [string|table] - Lua require() path to a table or a table.

Returns:

  • self [Utils.Class.Config] - updated class instance with the new options.

Example:

local Config = require("utils.class.config")
local config = Config:new()
config:add("module.name") -- Adds configuration from a module
config:add({
  font_size = 14,
  color_scheme = "Dracula"
}) -- Adds configuration directly from a table

⚙️ Utils

Class
Functions
Clone this wiki locally