|
15 | 15 | ---@alias PathBuf string |
16 | 16 |
|
17 | 17 | ---@class Wezterm: ExecDomain |
18 | | ----@field GLOBAL table<string, ANY> |
| 18 | +-- Provides global, in-process, in-memory, data storage for JSON-like variables |
| 19 | +-- that persists across config reloads. |
| 20 | +-- |
| 21 | +-- WezTerm's Lua files may be re-loaded and re-evaluated multiple times in different contexts |
| 22 | +-- or in different threads. |
| 23 | +-- If you'd like to keep track of state that lasts for the lifetime |
| 24 | +-- of your wezterm process then you cannot simply use |
| 25 | +-- global variables in the Lua script. |
| 26 | +-- |
| 27 | +-- `wezterm.GLOBAL` is a special `userdata` value that acts like a table. |
| 28 | +-- Writing to keys will copy the data that you assign into a global in-memory table |
| 29 | +-- and allow it to be read back later. |
| 30 | +-- |
| 31 | +-- Reads and writes from/to `wezterm.GLOBAL` are thread-safe but don't currently provide |
| 32 | +-- synchronization primitives for managing read-modify-write operations. |
| 33 | +-- |
| 34 | +-- You may store values with the following types: |
| 35 | +-- |
| 36 | +-- - `string` |
| 37 | +-- - `number` |
| 38 | +-- - `table` |
| 39 | +-- - `boolean` |
| 40 | +-- |
| 41 | +-- **Attempting to assign other types will raise an error** |
| 42 | +---@field GLOBAL userdata |
| 43 | +-- The `wezterm.color` module exposes functions that work with colors |
19 | 44 | ---@field color Wezterm.Color |
| 45 | +-- The `wezterm.gui` module exposes functions that operate on the GUI layer. |
| 46 | +-- |
| 47 | +-- The multiplexer may not be connected to a GUI, so attempting to |
| 48 | +-- resolve this module from the mux server will return `nil` |
20 | 49 | ---@field gui? Wezterm.Gui |
21 | 50 | ---@field mux Wezterm.Mux |
22 | 51 | ---@field nerdfonts Wezterm.NerdFont |
| 52 | +-- The `wezterm.plugin` module provides functions to manage Wezterm plugins |
23 | 53 | ---@field plugin Wezterm.Plugin |
| 54 | +-- The `wezterm.procinfo` module exposes functions that allow querying information |
| 55 | +-- about processes that are running on the local system |
24 | 56 | ---@field procinfo Wezterm.ProcInfo |
| 57 | +-- The `wezterm.serde` module provides functions for parsing the given string as |
| 58 | +-- JSON, YAML, or TOML, returning the corresponding Lua values, and vice versa |
25 | 59 | ---@field serde Wezterm.Serde |
| 60 | +-- The `wezterm.time` module exposes functions that allow working with time |
26 | 61 | ---@field time Wezterm.Time |
| 62 | +-- The `wezterm.url` module exposes functions that allow working with URLs |
27 | 63 | ---@field url Wezterm.Url |
| 64 | +-- Helper for defining key assignment actions in your configuration file. |
| 65 | +-- This is really just sugar for the underlying Lua -> Rust deserialation mapping |
| 66 | +-- that makes it a bit easier to identify where syntax errors may exist |
| 67 | +-- in your configuration file |
28 | 68 | ---@field action Action |
29 | | ----@field action_callback (fun(win: Window, pane: Pane, ...: any): (nil|false))|(fun(callback: ActionCallback):Action) |
30 | | ----@field add_to_config_reload_watch_list fun(path: string): nil Adds path to the list of files that are watched for config changes. If `automatically_reload_config` is enabled, then the config will be reloaded when any of the files that have been added to the watch list have changed. |
31 | | ----@field background_child_process fun(args: string[]): nil Accepts an argument list; it will attempt to spawn that command in the background. |
32 | | ----@field battery_info fun(): BatteryInfo[] Returns battery information for each of the installed batteries on the system. This is useful for example to assemble status information for the status bar. |
33 | | ----@field column_width fun(string): number Given a string parameter, returns the number of columns that that text occupies in the terminal, which is useful together with format-tab-title and update-right-status to compute/layout tabs and status information. |
34 | | ----@field config_builder fun(): Config Returns a config builder object that can be used to define your configuration. |
35 | | ----@field config_dir string This constant is set to the path to the directory in which your wezterm.lua configuration file was found. |
36 | | ----@field config_file string This constant is set to the path to the wezterm.lua that is in use. |
| 69 | +-- This function is a helper to register a custom event |
| 70 | +-- and return an action triggering it. |
| 71 | +-- |
| 72 | +-- It is helpful to write custom key bindings directly, |
| 73 | +-- without having to declare the event and use it in a different place. |
| 74 | +-- |
| 75 | +-- The implementation is essentially the same as: |
| 76 | +-- |
| 77 | +-- ```lua |
| 78 | +-- function wezterm.action_callback(callback) |
| 79 | +-- local event_id = '...' -- the function generates a unique event id |
| 80 | +-- wezterm.on(event_id, callback) |
| 81 | +-- return wezterm.action.EmitEvent(event_id) |
| 82 | +-- end |
| 83 | +-- ``` |
| 84 | +---@field action_callback fun(callback: ActionCallback): Action |
| 85 | +-- Adds path to the list of files that are watched for config changes. |
| 86 | +-- |
| 87 | +-- If `automatically_reload_config` is enabled, then the config will be reloaded |
| 88 | +-- when any of the files that have been added to the watch list have changed |
| 89 | +---@field add_to_config_reload_watch_list fun(path: string) |
| 90 | +-- Accepts an argument list; it will attempt to spawn that command in the background |
| 91 | +---@field background_child_process fun(args: string[]) |
| 92 | +-- Returns the battery information for each of the installed batteries on the system. |
| 93 | +-- |
| 94 | +-- This is useful for example to assemble status information for the status bar |
| 95 | +---@field battery_info fun(): BatteryInfo[] |
| 96 | +-- Given a `string` parameter, returns the number of columns |
| 97 | +-- that text occupies in the terminal, |
| 98 | +-- which is useful together with `format-tab-title` and `update-right-status` |
| 99 | +-- to compute/layout tabs and status information |
| 100 | +---@field column_width fun(value: string): number |
| 101 | +-- Returns a `Config` object that can be used to define your configuration |
| 102 | +---@field config_builder fun(): Config |
| 103 | +-- This constant is set to the path to the directory |
| 104 | +-- in which your `wezterm.lua` configuration file was found |
| 105 | +---@field config_dir string |
| 106 | +-- This constant is set to the path to the `wezterm.lua` that is in use |
| 107 | +---@field config_file string |
37 | 108 | ---@field default_hyperlink_rules fun(): HyperLinkRule[] Returns the compiled-in default values for hyperlink_rules. |
38 | | ----@field default_ssh_domains fun(): SshDomain[] Computes a list of SshDomain objects based on the set of hosts discovered in your ~/.ssh/config. Each host will have both a plain SSH and a multiplexing SSH domain generated and returned in the list of domains. The former don't require wezterm to be installed on the remote host, while the latter do require it. The intended purpose of this function is to allow you the opportunity to edit/adjust the returned information before assigning it to your config. |
39 | | ----@field default_wsl_domains fun(): { name: string, distribution: string }[] Computes a list of WslDomain objects, each one representing an installed WSL distribution on your system. This list is the same as the default value for the wsl_domains configuration option, which is to make a WslDomain with the distribution field set to the name of WSL distro and the name field set to name of the distro but with "WSL:" prefixed to it. |
40 | | ----@field emit fun(event: string, ...) |
41 | | ----@field enumerate_ssh_hosts fun(ssh_config_file_name: string?): { [string] : { hostname: string, identityagent: string, identityfile: string, port: string, user: string, userknownhostsfile: string } } This function will parse your ssh configuration file(s) and extract from them the set of literal (non-pattern, non-negated) host names that are specified in Host and Match stanzas contained in those configuration files and return a mapping from the hostname to the effective ssh config options for that host. You may optionally pass a list of ssh configuration files that should be read, in case you have a special configuration. |
42 | | ----@field executable_dir string This constant is set to the directory containing the wezterm executable file. |
43 | | ----@field font (fun(font_attributes: FontAttributes): Fonts)|(fun(name: string, font_attributes: FontAttributes?): Fonts) https://wezfurlong.org/wezterm/config/lua/wezterm/font.html |
44 | | ----@field font_with_fallback fun(fonts: string[]|FontAttributes[]): Fonts https://wezfurlong.org/wezterm/config/lua/wezterm/font_with_fallback.html |
45 | | ----@field format fun(...: FormatItem[]): string Can be used to produce a formatted string with terminal graphic attributes such as bold, italic and colors. The resultant string is rendered into a string with wezterm compatible escape sequences embedded. |
46 | | ----@field get_builtin_color_schemes any #TODO |
47 | | ----@field glob fun(pattern: string, relative_to: string?): string[] This function evalutes the glob pattern and returns an array containing the absolute file names of the matching results. Due to limitations in the lua bindings, all of the paths must be able to be represented as UTF-8 or this function will generate an error. |
| 109 | +-- Computes a list of `SshDomain` objects based on the set of hosts |
| 110 | +-- discovered in `~/.ssh/config`. |
| 111 | +-- |
| 112 | +-- Each host will have both a plain SSH and a multiplexing SSH domain |
| 113 | +-- generated and returned in the list of domains. |
| 114 | +-- The former don't require wezterm to be installed on the remote host, |
| 115 | +-- while the latter do require it. |
| 116 | +-- |
| 117 | +-- The intended purpose of this function is to give you the opportunity |
| 118 | +-- to edit/adjust the returned information before assigning it to your config |
| 119 | +---@field default_ssh_domains fun(): SshDomain[] |
| 120 | +-- Computes a list of `WslDomain` objects, each one representing |
| 121 | +-- an installed WSL distribution on your system. |
| 122 | +-- |
| 123 | +-- This list is the same as the default value for the `wsl_domains` configuration option, |
| 124 | +-- which is to make a `WslDomain` with the `distribution` field set to the name |
| 125 | +-- of the WSL distro and the `name` field set to name of the distro |
| 126 | +-- but with `"WSL:"` prefixed to it |
| 127 | +---@field default_wsl_domains fun(): WslDomain[] |
| 128 | +---@field emit fun(event: string, ...: any) |
| 129 | +-- This function will parse your ssh configuration file(s) and extract from them |
| 130 | +-- the set of literal (non-pattern, non-negated) host names that are specified |
| 131 | +-- in `Host` and `Match` stanzas contained in those configuration files |
| 132 | +-- and return a mapping from the hostname to the effective ssh config options for that host. |
| 133 | +-- |
| 134 | +-- You may optionally pass a list of ssh configuration files that should be read |
| 135 | +-- in case you have a special configuration |
| 136 | +---@field enumerate_ssh_hosts fun(ssh_config_file_name: (string[]|string)?): table<string, SshHost> |
| 137 | +-- This constant is set to the directory containing the wezterm executable file |
| 138 | +---@field executable_dir string |
| 139 | +-- [Info](https://wezfurlong.org/wezterm/config/lua/wezterm/font.html) |
| 140 | +---@field font (fun(attributes: FontFamilyAttributes|FontFamilyExtendedAttributes): FontFamilyAttributes)|(fun(name: string, attributes: FontAttributes?): FontFamilyAttributes) |
| 141 | +-- [Info](https://wezfurlong.org/wezterm/config/lua/wezterm/font_with_fallback.html) |
| 142 | +---@field font_with_fallback fun(fonts: (string|FontAttributes)[]): Fonts |
| 143 | +--- Can be used to produce a formatted string with terminal graphic attributes |
| 144 | +--- such as `bold`, `italic` and `colors`. |
| 145 | +--- |
| 146 | +--- The result is a string with wezterm-compatible escape sequences embedded |
| 147 | +---@field format fun(...: FormatItem[]): string |
| 148 | +---@field get_builtin_color_schemes any |
| 149 | +-- This function evalutes the glob pattern and returns an array |
| 150 | +-- containing the absolute file names of the matching results. |
| 151 | +-- |
| 152 | +-- Due to limitations in the Lua bindings, |
| 153 | +-- all of the paths must be able to be represented as `UTF-8` |
| 154 | +-- or this function will generate an error |
| 155 | +---@field glob fun(pattern: string, relative_to: string?): string[] |
48 | 156 | ---@field has_action fun(action: string): boolean |
49 | 157 | ---@field home_dir string This constant is set to the home directory of the user running wezterm. |
50 | 158 | ---@field hostname fun(): string This function returns the current hostname of the system that is running wezterm. This can be useful to adjust configuration based on the host. |
|
74 | 182 | ---@field truncate_left fun(string: string, max_width: number): string Returns a copy of string that is no longer than max_width columns (as measured by wezterm.column_width). Truncation occurs by reemoving excess characters from the left end of the string. |
75 | 183 | ---@field truncate_right fun(string: string, max_width: number): string Returns a copy of string that is no longer than max_width columns (as measured by wezterm.column_width). Truncation occurs by reemoving excess characters from the right end of the string. |
76 | 184 | ---@field utf16_to_utf8 fun(string: string): string Overly specific and exists primarily to workaround this wsl.exe issue. It takes as input a string and attempts to convert it from utf16 to utf8. |
77 | | ----@field version string This constant is set to the wezterm version string that is also reported by running wezterm -V. This can potentially be used to adjust configuration according to the installed version. |
| 185 | +-- This constant is set to the wezterm version string that is also reported |
| 186 | +-- by running `wezterm -V`. |
| 187 | +-- |
| 188 | +-- This can potentially be used to adjust configuration according to the installed version |
| 189 | +---@field version string |
78 | 190 | ---@field gradient_colors fun(gradient: Gradient, num_colors: number): Color[] |
0 commit comments