### Launch a login shell with wezterm start Source: https://wezterm.org/cli/start.html?q= Example of spawning a specific program as a login shell using the start command. ```bash wezterm start -- bash -l ``` -------------------------------- ### Configure window position with wezterm start Source: https://wezterm.org/cli/start.html?q= Examples of setting the initial window position using different coordinate systems. ```bash --position 10,20 to set x=10, y=20 in screen coordinates --position screen:10,20 to set x=10, y=20 in screen coordinates --position main:10,20 to set x=10, y=20 relative to the main monitor --position active:10,20 to set x=10, y=20 relative to the active monitor --position HDMI-1:10,20 to set x=10, y=20 relative to the monitor named HDMI-1 ``` -------------------------------- ### Install Wezterm on openSUSE Source: https://wezterm.org/install/linux.html?q= Follow these steps for initial installation on openSUSE. This involves installing dnf, enabling the Copr repository, and then installing wezterm. ```bash $ sudo zypper in dnf $ sudo dnf copr enable wezfurlong/wezterm-nightly ``` ```bash $ sudo dnf install wezterm ``` -------------------------------- ### Example Hotkey Configuration Source: https://wezterm.org/config/lua/keyassignment/ActivateWindowRelativeNoWrap.html?q= An example of how to configure hotkeys in wezterm to cycle between windows using `ActivateWindowRelativeNoWrap`. ```APIDOC ## Example Hotkey Configuration ### Description This example demonstrates setting up hotkeys to cycle through GUI windows using `ActivateWindowRelativeNoWrap`. ### Method Configuration within `wezterm.conf` ### Parameters This snippet does not define parameters directly, but uses the `delta` parameter of `ActivateWindowRelativeNoWrap`. ### Request Example ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = {} config.keys = { { key = 'r', mods = 'ALT', action = act.ActivateWindowRelativeNoWrap(1), }, { key = 'e', mods = 'ALT', action = act.ActivateWindowRelativeNoWrap(-1), }, } return config ``` ### Response This configuration does not produce a direct response, but modifies the behavior of the wezterm application. ``` -------------------------------- ### Configure Two Workspaces on Startup Source: https://wezterm.org/config/lua/gui-events/gui-startup.html This elaborate example configures two workspaces: 'coding' and 'automation'. It sets the current directory and kicks off a build command for the 'coding' workspace. It also handles arguments passed via `wezterm start`. Requires `wezterm` and `wezterm.mux`. ```lua local wezterm = require 'wezterm' local mux = wezterm.mux local config = {} wezterm.on('gui-startup', function(cmd) -- allow `wezterm start -- something` to affect what we spawn -- in our initial window local args = {} if cmd then args = cmd.args end -- Set a workspace for coding on a current project -- Top pane is for the editor, bottom pane is for the build tool local project_dir = wezterm.home_dir .. '/wezterm' local tab, build_pane, window = mux.spawn_window { workspace = 'coding', cwd = project_dir, args = args, } local editor_pane = build_pane:split { direction = 'Top', size = 0.6, cwd = project_dir, } -- may as well kick off a build in that pane build_pane:send_text 'cargo build\n' -- A workspace for interacting with a local machine that -- runs some docker containers for home automation local tab, pane, window = mux.spawn_window { workspace = 'automation', args = { 'ssh', 'vault' }, } -- We want to startup in the coding workspace mux.set_active_workspace 'coding' end) return config ``` -------------------------------- ### Example: Setting up hotkeys to activate specific windows Source: https://wezterm.org/config/lua/keyassignment/ActivateWindow.html?q= An example of how to configure hotkeys to activate specific windows using the ActivateWindow function. ```APIDOC ## Example: Setting up hotkeys to activate specific windows ### Description This example demonstrates how to set up keyboard shortcuts (CMD+ALT + number) to activate specific WezTerm windows. ### Method N/A (Configuration script) ### Endpoint N/A (Internal WezTerm configuration) ### Parameters None ### Request Example ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = {} config.keys = {} for i = 1, 8 do -- CMD+ALT + number to activate that window table.insert(config.keys, { key = tostring(i), mods = 'CMD|ALT', action = act.ActivateWindow(i - 1), }) end return config ``` ### Response N/A (This is a configuration script) ``` -------------------------------- ### Create New Workspace with PromptInputLine and Formatted Text Source: https://wezterm.org/config/lua/keyassignment/PromptInputLine.html?q= This example demonstrates using `PromptInputLine` to get a name for a new workspace and utilizes `wezterm.format` for colored and bold text in the description. The input is used to perform the `SwitchToWorkspace` action. ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = wezterm.config_builder() config.keys = { { key = 'N', mods = 'CTRL|SHIFT', action = act.PromptInputLine { description = wezterm.format { { Attribute = { Intensity = 'Bold' } }, { Foreground = { AnsiColor = 'Fuchsia' } }, { Text = 'Enter name for new workspace' }, }, action = wezterm.action_callback(function(window, pane, line) -- line will be `nil` if they hit escape without entering anything -- An empty string if they just hit enter -- Or the actual line of text they wrote if line then window:perform_action( act.SwitchToWorkspace { name = line, }, pane ) end end), }, }, } return config ``` -------------------------------- ### Install Rustup and Build WezTerm from Git Repository Source: https://wezterm.org/install/source.html?q= Installs Rust using rustup, clones the WezTerm git repository, initializes submodules, installs dependencies, and builds WezTerm in release mode. Use this method for development or contributing to WezTerm. ```bash $ curl https://sh.rustup.rs -sSf | sh -s $ git clone --depth=1 --branch=main --recursive https://github.com/wezterm/wezterm.git $ cd wezterm $ git submodule update --init --recursive $ ./get-deps $ cargo build --release $ cargo run --release --bin wezterm -- start ``` -------------------------------- ### Example: Toggle Opacity Source: https://wezterm.org/config/lua/window/set_config_overrides.html?q= An example demonstrating how to use `window:set_config_overrides` to toggle window opacity using a key binding. ```APIDOC ## Example: Toggle Opacity ### Description This example uses a key assignment (`CTRL-SHIFT-B`) to toggle opacity for the window. ### Method `window:set_config_overrides` (called within a custom event handler) ### Endpoint N/A (This is a Lua function call within the WezTerm configuration) ### Request Example ```lua local wezterm = require 'wezterm' wezterm.on('toggle-opacity', function(window, pane) local overrides = window:get_config_overrides() or {} if not overrides.window_background_opacity then overrides.window_background_opacity = 0.5 else overrides.window_background_opacity = nil end window:set_config_overrides(overrides) end) return { keys = { { key = 'B', mods = 'CTRL', action = wezterm.action.EmitEvent 'toggle-opacity', }, }, } ``` ### Response N/A (The effect is visual: the window's background opacity is changed.) ``` -------------------------------- ### Install WezTerm on openSUSE Source: https://wezterm.org/install/linux.html Follow these steps to install WezTerm on openSUSE. This involves installing dnf, enabling the Copr repository, and then installing WezTerm. ```bash $ sudo zypper in dnf $ sudo dnf copr enable wezfurlong/wezterm-nightly ``` ```bash $ sudo dnf install wezterm ``` -------------------------------- ### Install WezTerm with Scoop Source: https://wezterm.org/install/windows.html Add the extras bucket and install WezTerm using the Scoop command-line installer. ```bash $ scoop bucket add extras $ scoop install wezterm ``` -------------------------------- ### Install WezTerm via pkgin Source: https://wezterm.org/install/netbsd.html Use this command to install the pre-built WezTerm binary from the NetBSD package repositories. ```shell $ pkgin install wezterm ``` -------------------------------- ### Install a Wezterm Plugin Source: https://wezterm.org/config/plugins.html?q= Use `wezterm.plugin.require` with a Git URL to install a plugin. The plugin is cloned into the Wezterm runtime directory. ```lua local wezterm = require 'wezterm' local a_plugin = wezterm.plugin.require 'https://github.com/owner/repo' local config = wezterm.config_builder() a_plugin.apply_to_config(config) return config ``` -------------------------------- ### Install Rustup and Build WezTerm from Source Tarball Source: https://wezterm.org/install/source.html?q= Installs Rust using rustup, downloads a source tarball, extracts it, installs dependencies, and builds WezTerm in release mode. Use this method if you do not plan to submit pull requests. ```bash $ curl https://sh.rustup.rs -sSf | sh -s $ curl -LO https://github.com/wezterm/wezterm/releases/download/20240203-110809-5046fc22/wezterm-20240203-110809-5046fc22-src.tar.gz $ tar -xzf wezterm-20240203-110809-5046fc22-src.tar.gz $ cd wezterm-20240203-110809-5046fc22 $ ./get-deps $ cargo build --release $ cargo run --release --bin wezterm -- start ``` -------------------------------- ### CLI Command: wezterm start Source: https://wezterm.org/cli/start.html?q= Starts the WezTerm GUI with various configuration options for window management and program execution. ```APIDOC ## CLI COMMAND: wezterm start ### Description Starts the GUI, optionally running an alternative program. ### Arguments - **PROG** (string) - Optional - Instead of executing your shell, run PROG. ### Options - **--no-auto-connect** (flag) - Optional - Do not connect to domains marked as connect_automatically. - **--always-new-process** (flag) - Optional - Always start the GUI in this invocation rather than asking an existing instance. - **--new-tab** (flag) - Optional - Spawn a new tab into the active window. - **--cwd** (string) - Optional - Specify the current working directory. - **--class** (string) - Optional - Override the default windowing system class or app_id. - **--workspace** (string) - Optional - Override the default workspace name. - **--position** (string) - Optional - Override the position for the initial window. - **--domain** (string) - Optional - Name of the multiplexer domain to connect to. - **--attach** (flag) - Optional - Attach to existing panes in a domain instead of spawning a new PROG. - **-h, --help** (flag) - Optional - Print help information. ``` -------------------------------- ### Install WezTerm via APT Source: https://wezterm.org/install/linux.html Install the stable version of WezTerm using the APT package manager. ```bash $ sudo apt install wezterm ``` -------------------------------- ### CLI Command: wezterm start Source: https://wezterm.org/cli/start.html Starts the WezTerm GUI with various configuration options for window management and program execution. ```APIDOC ## CLI COMMAND: wezterm start ### Description Starts the GUI, optionally running an alternative program. ### Arguments - **PROG** (string) - Optional - Instead of executing your shell, run PROG. ### Options - **--no-auto-connect** (flag) - Optional - Do not connect to domains marked as connect_automatically. - **--always-new-process** (flag) - Optional - Always start the GUI in this invocation rather than asking an existing instance. - **--new-tab** (flag) - Optional - Spawn a new tab into the active window. - **--cwd** (string) - Optional - Specify the current working directory. - **--class** (string) - Optional - Override the default windowing system class or app_id. - **--workspace** (string) - Optional - Override the default workspace name. - **--position** (string) - Optional - Override the position for the initial window. - **--domain** (string) - Optional - Name of the multiplexer domain to connect to. - **--attach** (flag) - Optional - Attach to existing running panes in the domain. - **-h, --help** (flag) - Optional - Print help information. ``` -------------------------------- ### Example `wezterm show-keys` Output Source: https://wezterm.org/cli/show-keys.html?q= This is a truncated example of the output from `wezterm show-keys`, showing key tables for default, copy, and search modes, as well as mouse bindings. ```text Default key table ----------------- CTRL Tab -> ActivateTabRelative(1) SHIFT | CTRL Tab -> ActivateTabRelative(-1) ... Key Table: copy_mode -------------------- Tab -> CopyMode(MoveForwardWord) SHIFT Tab -> CopyMode(MoveBackwardWord) SHIFT $ -> CopyMode(MoveToEndOfLineContent) ... Key Table: search_mode ---------------------- Enter -> CopyMode(PriorMatch) Escape -> CopyMode(Close) CTRL n -> CopyMode(NextMatch) ... Mouse ----- Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Cell) SHIFT Down { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(None) ALT Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Block) ... ``` -------------------------------- ### TlsDomainServer Configuration Example Source: https://wezterm.org/config/lua/TlsDomainServer.html Example of how to configure TLS servers using the TlsDomainServer struct in a Lua configuration file. ```APIDOC ## TlsDomainServer Configuration ### Description Specifies information about how to define the server side of a TLS Domain. ### Method N/A (Configuration Structure) ### Endpoint N/A (Configuration Structure) ### Parameters #### Request Body Fields (within `config.tls_servers` table) - **bind_address** (string) - Required - The address:port combination on which the server will listen for client connections. - **pem_private_key** (string) - Optional - The path to an x509 PEM encoded private key file. - **pem_cert** (string) - Optional - The path to an x509 PEM encoded certificate file. - **pem_ca** (string) - Optional - The path to an x509 PEM encoded CA chain file. - **pem_root_certs** (array of strings) - Optional - A set of paths to load additional CA certificates. Each entry can be a path to a directory or a PEM encoded CA file. ### Request Example ```lua config.tls_servers = { { bind_address = 'server.hostname:8080', pem_private_key = "/path/to/key.pem", pem_cert = "/path/to/cert.pem", pem_ca = "/path/to/chain.pem", pem_root_certs = { "/some/path/ca1.pem", "/some/path/ca2.pem" }, }, } ``` ### Response N/A (Configuration Structure) ``` -------------------------------- ### Install WezTerm using Homebrew Source: https://wezterm.org/install/macos.html Install the stable version of WezTerm using the Homebrew package manager. ```shell $ brew install --cask wezterm ``` -------------------------------- ### Example SSH Configuration Source: https://wezterm.org/config/lua/wezterm/enumerate_ssh_hosts.html This is an example of a ~/.ssh/config file. Note that 'Host' groups with wildcards are not returned by wezterm.enumerate_ssh_hosts() as they do not represent concrete host names. ```sshconfig Host aur.archlinux.org IdentityFile ~/.ssh/aur User aur Host 192.168.1.* ForwardAgent yes ForwardX11 yes Host woot User someone Hostname localhost ``` -------------------------------- ### Install wezterm.terminfo Source: https://wezterm.org/config/lua/config/term.html Use this command to download and install the wezterm terminfo definition. This enables advanced terminal features. ```bash $ tempfile=$(mktemp) \ && curl -o $tempfile https://raw.githubusercontent.com/wezterm/wezterm/main/termwiz/data/wezterm.terminfo \ && tic -x -o ~/.terminfo $tempfile \ && rm $tempfile ``` -------------------------------- ### ShowLauncher Action Source: https://wezterm.org/config/lua/keyassignment/ShowLauncher.html Configuring a keybinding to activate the launcher menu in WezTerm. ```APIDOC ## ShowLauncher ### Description Activates the Launcher Menu in the current tab. ### Usage Add the action to your `wezterm.lua` configuration file within the `config.keys` table. ### Example ```lua config.keys = { { key = 'l', mods = 'ALT', action = wezterm.action.ShowLauncher }, } ``` ``` -------------------------------- ### Get Plugin Directory Information Source: https://wezterm.org/config/plugins.html?q= The `wezterm.plugin.list()` function returns an array of triplets containing component, plugin_dir, and url for each installed plugin. ```lua [ { "component": "filesCssZssZssZsUserssZsdevelopersZsprojectssZsmysDsPlugin", "plugin_dir": "/Users/alec/Library/Application Support/wezterm/plugins/filesCssZssZssZsUserssZsalecsZsprojectssZsbarsDswezterm", "url": "file:///Users/developer/projects/my.Plugin", }, ] ``` -------------------------------- ### Maximize Window on Startup Source: https://wezterm.org/config/lua/gui-events/gui-startup.html This example creates a default window and maximizes it on startup. It requires the `wezterm` and `wezterm.mux` modules. The `cmd` argument is passed to `mux.spawn_window`. ```lua local wezterm = require 'wezterm' local mux = wezterm.mux local config = {} wezterm.on('gui-startup', function(cmd) local tab, pane, window = mux.spawn_window(cmd or {}) window:gui_window():maximize() end) return config ``` -------------------------------- ### Launching Neovim with WezTerm Terminfo Source: https://wezterm.org/faq.html Command to start Neovim with the TERM environment variable set to 'wezterm'. This ensures Neovim uses the installed terminfo file for proper display of advanced features. ```bash env TERM=wezterm nvim ``` -------------------------------- ### Override WezTerm Window Title Source: https://wezterm.org/config/lua/window-events/format-window-title.html This example overrides the default window title with custom logic. It's a starting point for creating your own title text. Note that asynchronous functions cannot be called from within this event handler. ```lua wezterm.on('format-window-title', function(tab, pane, tabs, panes, config) local zoomed = '' if tab.active_pane.is_zoomed then zoomed = '[Z] ' end local index = '' if #tabs > 1 then index = string.format('[%d/%d] ', tab.tab_index + 1, #tabs) end return zoomed .. index .. tab.active_pane.title end) ``` -------------------------------- ### Example: Creating a New Workspace Source: https://wezterm.org/config/lua/keyassignment/PromptInputLine.html?q= Demonstrates using PromptInputLine with wezterm.format for colored text to pick a name for a new workspace. ```APIDOC ## Example: Creating a New Workspace ### Description This example shows how to prompt the user for a workspace name using `act.PromptInputLine` with colored text via `wezterm.format`, and then creates a new workspace with the provided name. ### Code ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = wezterm.config_builder() config.keys = { { key = 'N', mods = 'CTRL|SHIFT', action = act.PromptInputLine { description = wezterm.format { { Attribute = { Intensity = 'Bold' } }, { Foreground = { AnsiColor = 'Fuchsia' } }, { Text = 'Enter name for new workspace' }, }, action = wezterm.action_callback(function(window, pane, line) -- line will be `nil` if they hit escape without entering anything -- An empty string if they just hit enter -- Or the actual line of text they wrote if line then window:perform_action( act.SwitchToWorkspace { name = line, }, pane ) end end), }, }, } return config ``` ``` -------------------------------- ### ShowLauncher Action Configuration Source: https://wezterm.org/config/lua/keyassignment/ShowLauncher.html?q= This snippet demonstrates how to bind the `ShowLauncher` action to a key combination in your WezTerm configuration. ```APIDOC ## ShowLauncher Action ### Description Activates the Launcher Menu in the current tab. ### Method Configuration ### Endpoint N/A (Configuration setting) ### Parameters N/A ### Request Example ```lua config.keys = { { key = 'l', mods = 'ALT', action = wezterm.action.ShowLauncher }, } ``` ### Response N/A (This is a configuration action, not an API endpoint with a response) ### Error Handling N/A ``` -------------------------------- ### Configure hotkeys for window activation Source: https://wezterm.org/config/lua/keyassignment/ActivateWindow.html Example configuration mapping CMD+ALT+number keys to activate specific windows. ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = {} config.keys = {} for i = 1, 8 do -- CMD+ALT + number to activate that window table.insert(config.keys, { key = tostring(i), mods = 'CMD|ALT', action = act.ActivateWindow(i - 1), }) end return config ``` -------------------------------- ### Example: Confirming Program Execution with wezterm Source: https://wezterm.org/config/lua/keyassignment/Confirmation.html?q= This snippet demonstrates how to use the Confirmation action to ask the user if they want to run 'htop' in a new window. It includes callbacks for both accepting and declining the action. Requires a nightly build of wezterm. ```lua local wezterm = require 'wezterm' local act = wezterm.action local config = wezterm.config_builder() config.keys = { { key = 'E', mods = 'CTRL|SHIFT', action = act.Confirmation { message = 'Do you want to run htop in a new window?', action = wezterm.action_callback(function(window, pane) window:perform_action( act.SpawnCommandInNewWindow { args = { 'htop' } }, pane ) end), cancel = wezterm.action_callback(function(window, pane) wezterm.log_error 'user declined' end), }, }, } return config ``` -------------------------------- ### Install WezTerm using MacPorts Source: https://wezterm.org/install/macos.html?q= Install WezTerm using MacPorts. This involves updating the MacPorts system first, then installing the wezterm package. ```shell sudo port selfupdate sudo port install wezterm ``` -------------------------------- ### Install WezTerm using MacPorts Source: https://wezterm.org/install/macos.html Install WezTerm using the MacPorts package manager. This involves updating MacPorts and then installing the wezterm package. ```shell sudo port selfupdate sudo port install wezterm ``` -------------------------------- ### Install WezTerm on Void Linux Source: https://wezterm.org/install/linux.html Use the xbps-install command to install WezTerm on Void Linux. Ensure you also install the nerd-fonts-ttf package for font support. ```bash $ sudo xbps-install -S wezterm ``` -------------------------------- ### Merging Configuration Fragments Source: https://wezterm.org/config/files.html?q= Examples showing how to define configuration fragments and merge them into a single return table. ```lua local wezterm = require 'wezterm' local config = {} config.color_scheme = 'Batman' return config ``` ```lua local wezterm = require 'wezterm' local config = {} config.font = wezterm.font 'JetBrains Mono' return config ``` ```lua local wezterm = require 'wezterm' local config = {} config.font = wezterm.font 'JetBrains Mono' config.color_scheme = 'Batman' return config ``` -------------------------------- ### Install WezTerm with Chocolatey Source: https://wezterm.org/install/windows.html Install the WezTerm package from the Chocolatey Community Repository. ```bash $ choco install wezterm -y ``` -------------------------------- ### Install WezTerm on openSUSE Source: https://wezterm.org/install/linux.html Use zypper to install the stable version of WezTerm on openSUSE Tumbleweed/Slowroll. ```bash $ zypper install wezterm ``` -------------------------------- ### Configure integrated_title_buttons Source: https://wezterm.org/config/lua/config/integrated_title_buttons.html?q= Examples showing the default configuration, reordering buttons, and removing specific buttons. ```lua config.integrated_title_buttons = { 'Hide', 'Maximize', 'Close' } ``` ```lua config.integrated_title_buttons = { 'Close', 'Maximize', 'Hide' } ``` ```lua config.integrated_title_buttons = { 'Close' } ``` -------------------------------- ### Install WezTerm using Linuxbrew Tap Source: https://wezterm.org/install/linux.html Install the stable version of WezTerm using the wezterm/wezterm-linuxbrew tap. ```bash $ brew tap wezterm/wezterm-linuxbrew $ brew install wezterm/wezterm-linuxbrew/wezterm ``` -------------------------------- ### Configure mux-startup event in WezTerm Source: https://wezterm.org/config/lua/mux-events/mux-startup.html Use this event to spawn custom windows and panes during server initialization. If panes are created here, they take precedence over default program configurations. ```lua local wezterm = require 'wezterm' local mux = wezterm.mux -- this is called by the mux server when it starts up. -- It makes a window split top/bottom wezterm.on('mux-startup', function() local tab, pane, window = mux.spawn_window {} pane:split { direction = 'Top' } end) return { unix_domains = { { name = 'unix' }, }, } ``` -------------------------------- ### Install and upgrade WezTerm with winget Source: https://wezterm.org/install/windows.html Use the Windows Package Manager to install or upgrade the WezTerm application. ```bash $ winget install wez.wezterm ``` ```bash $ winget upgrade wez.wezterm ``` -------------------------------- ### QuickSelectArgs Constructor Source: https://wezterm.org/config/lua/wezterm/action.html Demonstrates the basic constructor syntax for QuickSelectArgs. ```lua wezterm.action.QuickSelectArgs ``` -------------------------------- ### Using Default Hyperlink Rules as a Base Source: https://wezterm.org/config/lua/config/hyperlink_rules.html?q= Shows how to initialize `config.hyperlink_rules` with the default WezTerm rules and then add custom rules. ```lua -- Use the defaults as a base config.hyperlink_rules = wezterm.default_hyperlink_rules() ``` -------------------------------- ### ShowLauncherArgs Configuration Source: https://wezterm.org/config/lua/keyassignment/ShowLauncherArgs.html?q= Configures the launcher menu behavior using a Lua table of arguments. ```APIDOC ## ShowLauncherArgs ### Description Activates the Launcher Menu in the current tab, scoping it to a set of items and with an optional title. ### Parameters #### Request Body - **flags** (string) - Required - The set of flags that specifies what to show in the launcher (e.g., "FUZZY", "TABS", "DOMAINS", "WORKSPACES", "COMMANDS"). Multiple flags can be joined with '|'. - **title** (string) - Optional - The title to show in the tab while the launcher is active. - **help_text** (string) - Optional - A string to display when in the default mode. - **fuzzy_help_text** (string) - Optional - A string to display when in fuzzy finding mode. - **alphabet** (string) - Optional - A string of unique characters used to calculate key press shortcuts. ### Request Example { "flags": "FUZZY|TABS", "title": "My Launcher" } ``` -------------------------------- ### Basic QuickSelectArgs Usage Source: https://wezterm.org/config/lua/keyassignment/QuickSelectArgs.html?q= This example demonstrates how to use QuickSelectArgs to activate Quick Select mode with a specific set of HTTP regex patterns, overriding the default configuration. ```APIDOC ## QuickSelectArgs ### Description Activates Quick Select Mode but with the option to override the global configuration. ### Method wezterm.action.QuickSelectArgs ### Parameters #### Fields - `patterns` (table) - If present, completely overrides the normal set of patterns and uses only the patterns specified. - `alphabet` (string) - If present, this alphabet is used instead of `quick_select_alphabet`. - `action` (wezterm_action) - If present, this key assignment action is performed as if by `window:perform_action` when an item is selected. The normal clipboard action is NOT performed in this case. - `skip_action_on_paste` (boolean) - Overrides whether `action` is performed after an item is selected using a capital value (when paste occurs). (_Since: Nightly Builds Only_) - `label` (string) - If present, replaces the string "copy" that is shown at the bottom of the overlay; you can use this to indicate which action will happen if you are using `action`. - `scope_lines` (number) - Specify the number of lines to search above and below the current viewport. The default is 1000 lines. The scope will be increased to the current viewport height if it is smaller than the viewport. (_Since: Version 20220807-113146-c2fee766_). In earlier releases, the entire scrollback was always searched. ### Request Example ```lua local wezterm = require 'wezterm' config.keys = { { key = 'P', mods = 'CTRL', action = wezterm.action.QuickSelectArgs { patterns = { 'https?://\\S+', }, }, }, } ``` ``` -------------------------------- ### Install WezTerm terminfo definition Source: https://wezterm.org/config/lua/config/term.html?q= Downloads and installs the WezTerm terminfo file to enable advanced terminal features. ```bash $ tempfile=$(mktemp) \ && curl -o $tempfile https://raw.githubusercontent.com/wezterm/wezterm/main/termwiz/data/wezterm.terminfo \ && tic -x -o ~/.terminfo $tempfile \ && rm $tempfile ``` -------------------------------- ### wezterm.action.ShowLauncherArgs Source: https://wezterm.org/config/lua/keyassignment/ShowLauncherArgs.html Activates the Launcher Menu in the current tab, allowing users to select from various items like tabs, domains, or workspaces. ```APIDOC ## wezterm.action.ShowLauncherArgs ### Description Activates the Launcher Menu in the current tab, scoping it to a set of items and with an optional title. ### Parameters #### Request Body - **flags** (string) - Required - The set of flags that specifies what to show in the launcher (e.g., "TABS|DOMAINS"). - **title** (string) - Optional - The title to show in the tab while the launcher is active. - **help_text** (string) - Optional - A string to display when in the default mode. - **fuzzy_help_text** (string) - Optional - A string to display when in fuzzy finding mode. - **alphabet** (string) - Optional - A string of unique characters used to calculate key press shortcuts. ### Request Example { "flags": "FUZZY|TABS", "title": "Select a Tab" } ### Supported Flags - **FUZZY**: Activate in fuzzy-only mode. - **TABS**: Include the list of tabs from the current window. - **LAUNCH_MENU_ITEMS**: Include the launch_menu items. - **DOMAINS**: Include multiplexing domains. - **KEY_ASSIGNMENTS**: Include items taken from your key assignments. - **WORKSPACES**: Include workspaces. - **COMMANDS**: Include a number of default commands. ``` -------------------------------- ### Install WezTerm via Flatpak Source: https://wezterm.org/install/linux.html?q= Use this command to install WezTerm from Flathub. Ensure Flatpak is set up on your system first. ```bash $ flatpak install flathub org.wezfurlong.wezterm ``` -------------------------------- ### SpawnWindow Action Source: https://wezterm.org/config/lua/keyassignment/SpawnWindow.html Configuring a keybinding to trigger the creation of a new window. ```APIDOC ## SpawnWindow ### Description Creates a new window containing a tab from the default tab domain. ### Usage Example ```lua config.keys = { { key = 'n', mods = 'SHIFT|CTRL', action = wezterm.action.SpawnWindow }, } ``` ``` -------------------------------- ### Example: Toggle Ligatures Source: https://wezterm.org/config/lua/window/set_config_overrides.html?q= An example demonstrating how to use `window:set_config_overrides` to toggle font ligatures on and off using a key binding. ```APIDOC ## Example: Toggle Ligatures ### Description This example uses a key assignment (`CTRL-SHIFT-E`) to toggle the use of ligatures in the current window. ### Method `window:set_config_overrides` (called within a custom event handler) ### Endpoint N/A (This is a Lua function call within the WezTerm configuration) ### Request Example ```lua local wezterm = require 'wezterm' wezterm.on('toggle-ligature', function(window, pane) local overrides = window:get_config_overrides() or {} if not overrides.harfbuzz_features then -- If we haven't overridden it yet, then override with ligatures disabled overrides.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' } else -- else we did already, and we should disable out override now overrides.harfbuzz_features = nil end window:set_config_overrides(overrides) end) return { keys = { { key = 'E', mods = 'CTRL', action = wezterm.action.EmitEvent 'toggle-ligature', }, }, } ``` ### Response N/A (The effect is visual: ligatures are enabled or disabled in the window.) ``` -------------------------------- ### Example Usage of PastePrimarySelection Source: https://wezterm.org/config/lua/keyassignment/PastePrimarySelection.html Examples demonstrating how to bind the PastePrimarySelection action to keyboard shortcuts and mouse buttons in the WezTerm configuration. ```APIDOC ## Example Usage ### Keyboard Binding ```lua local wezterm = require 'wezterm' local act = wezterm.action config.keys = { { key = 'v', mods = 'SHIFT|CTRL', action = act.PastePrimarySelection }, } ``` ### Mouse Binding ```lua -- Middle mouse button pastes the primary selection. config.mouse_bindings = { { event = { Up = { streak = 1, button = 'Middle' } }, mods = 'NONE', action = act.PastePrimarySelection, }, } ``` ``` -------------------------------- ### Gigavolt (base16) configuration example Source: https://wezterm.org/colorschemes/g/index.html?q= Example of how to set the Gigavolt (base16) color scheme in the WezTerm configuration. ```lua config.color_scheme = 'Gigavolt (base16)' ``` -------------------------------- ### Geohot (Gogh) configuration example Source: https://wezterm.org/colorschemes/g/index.html?q= Example of how to set the Geohot (Gogh) color scheme in the WezTerm configuration. ```lua config.color_scheme = 'Geohot (Gogh)' ``` -------------------------------- ### Random Color Scheme for New Windows Source: https://wezterm.org/config/lua/wezterm.color/get_builtin_schemes.html Example demonstrating how to select and apply a random built-in color scheme to each new WezTerm window. ```APIDOC ## Random Color Scheme for New Windows ### Description This example configures WezTerm to pick a random color scheme from a predefined list for each newly created window. ### Method Uses `wezterm.color.get_builtin_schemes()` and `wezterm.on('window-config-reloaded')`. ### Endpoint N/A (Lua configuration) ### Parameters None ### Request Example ```lua local wezterm = require 'wezterm' -- The set of schemes that we like and want to put in our rotation local schemes = {} for name, scheme in pairs(wezterm.color.get_builtin_schemes()) do table.insert(schemes, name) end wezterm.on('window-config-reloaded', function(window, pane) -- If there are no overrides, this is our first time seeing -- this window, so we can pick a random scheme. if not window:get_config_overrides() then -- Pick a random scheme name local scheme = schemes[math.random(#schemes)] window:set_config_overrides { color_scheme = scheme, } end end) return {} ``` ### Response No direct response, but the window's color scheme will be updated. ``` -------------------------------- ### Module Initialization Source: https://wezterm.org/config/lua/wezterm/index.html How to import the wezterm module in your configuration file. ```APIDOC ## Initialization ### Description To access the wezterm API, you must require the module at the top of your configuration file. ### Code Example ```lua local wezterm = require 'wezterm' ``` ``` -------------------------------- ### wezterm.open_with Function Source: https://wezterm.org/config/lua/wezterm/open_with.html?q= Opens a given path or URL with a specified application or the system's default. ```APIDOC ## wezterm.open_with(path_or_url [, application]) ### Description This function opens the specified `path_or_url` with either the specified `application` or uses the default application if `application` was not passed in. _Since: Version 20220101-133340-7edc5b5a_ ### Parameters #### Path Parameters - **path_or_url** (string) - Required - The path to a file or a URL to open. - **application** (string) - Optional - The name of the application to use for opening the path_or_url. If not provided, the system's default application will be used. ### Request Example ```lua -- Opens a URL in your default browser wezterm.open_with 'http://example.com' -- Opens a URL specifically in firefox wezterm.open_with('http://example.com', 'firefox') ``` ### Response This function does not return a value. ``` -------------------------------- ### Split Window into Thirds on Startup Source: https://wezterm.org/config/lua/gui-events/gui-startup.html Use this snippet to split the initial window into thirds. It requires the `wezterm` and `wezterm.mux` modules. The `cmd` argument is passed to `mux.spawn_window`. ```lua local wezterm = require 'wezterm' local mux = wezterm.mux local config = {} wezterm.on('gui-startup', function(cmd) local tab, pane, window = mux.spawn_window(cmd or {}) -- Create a split occupying the right 1/3 of the screen pane:split { size = 0.3 } -- Create another split in the right of the remaining 2/3 -- of the space; the resultant split is in the middle -- 1/3 of the display and has the focus. pane:split { size = 0.5 } end) return config ``` -------------------------------- ### Install WezTerm using Homebrew Source: https://wezterm.org/install/macos.html?q= Install the stable version of WezTerm using Homebrew. This is a convenient method for users who manage their packages with Homebrew. ```shell $ brew install --cask wezterm ```