Last active
September 28, 2025 16:43
-
-
Save bogorad/85dbc0daf69823449048e3a0239c01d2 to your computer and use it in GitHub Desktop.
wezterm-config-crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Pull in the wezterm API | |
| local wezterm = require("wezterm") | |
| -- This will hold the configuration. | |
| local config = wezterm.config_builder() | |
| local act = wezterm.action | |
| -- Define the connection details for my persistent WezTerm server. | |
| local lxc_wezterm_domain = { | |
| name = "wezterm-server", | |
| remote_address = "wezterm.lan", | |
| username = "chuck", | |
| } | |
| -- Add my custom domain to the list of SSH domains. | |
| config.ssh_domains = wezterm.default_ssh_domains() | |
| table.insert(config.ssh_domains, lxc_wezterm_domain) | |
| -- We will try to connect to the remote server by default. | |
| -- If it fails, WezTerm will gracefully fall back to a local domain. | |
| config.default_domain = "wezterm-server" | |
| -- Assume all SSH domains are Posix-like for command spawning. | |
| for _, dom in ipairs(config.ssh_domains) do | |
| dom.assume_shell = "Posix" | |
| end | |
| -- UI Configurations | |
| config.font_size = 18 | |
| config.line_height = 1.2 | |
| config.color_scheme = "Catppuccin Mocha" | |
| config.initial_cols = 140 | |
| config.initial_rows = 80 | |
| config.bold_brightens_ansi_colors = "BrightAndBold" | |
| config.audible_bell = "Disabled" | |
| config.max_fps = 120 | |
| config.exit_behavior = "Close" | |
| config.window_close_confirmation = "NeverPrompt" | |
| -- Platform-specific settings for Windows and Linux | |
| if wezterm.target_triple == "x86_64-pc-windows-msvc" then | |
| config.font = wezterm.font("3270 Nerd Font Mono") | |
| config.default_prog = { "pwsh" } | |
| config.window_decorations = "RESIZE" | |
| elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then | |
| config.font = wezterm.font("3270 Nerd Font Mono", { weight = "Regular" }) | |
| config.unix_domains = { { | |
| name = "unix", | |
| } } | |
| end | |
| -- This table is the single source of truth for all launch items. | |
| local ssh_hosts = { | |
| { label = "rpi4", args = { "ssh", "[email protected]" } }, | |
| { label = "o-cloud", args = { "ssh", "[email protected]" } }, | |
| { label = "syn", args = { "ssh", "[email protected]" } }, | |
| { label = "r5s", args = { "ssh", "[email protected]" } }, | |
| { label = "nix-sp", args = { "ssh", "[email protected]" } }, | |
| { label = "spino", args = { "ssh", "[email protected]" } }, | |
| { label = "ago", args = { "ssh", "[email protected]" } }, | |
| { label = "bash", args = { "bash" } }, | |
| { label = "hmx", args = { "ssh", "[email protected]", "-p", "44935" } }, | |
| } | |
| --------------------------------------------------- | |
| -- Leader Key and Base Keybindings | |
| config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 2000 } | |
| local keys = { | |
| { key = "l", mods = "ALT", action = act.ShowLauncher }, | |
| { key = "f", mods = "ALT", action = act.TogglePaneZoomState }, | |
| { key = "[", mods = "LEADER", action = act.ActivateCopyMode }, | |
| { key = "c", mods = "LEADER", action = act.SpawnTab("CurrentPaneDomain") }, | |
| { key = "w", mods = "LEADER", action = act.CloseCurrentTab({ confirm = false }) }, | |
| { key = "w", mods = "CTRL", action = act.CloseCurrentPane({ confirm = false }) }, | |
| { key = "Tab", mods = "LEADER", action = act.ActivateTabRelative(1) }, | |
| { key = "Tab", mods = "LEADER|SHIFT", action = act.ActivateTabRelative(-1) }, | |
| { | |
| key = "|", | |
| mods = "LEADER|SHIFT", | |
| -- action = act.SplitPane({ direction = "Right", size = { Percent = 50 }, domain = "CurrentPaneDomain" }), | |
| action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }), | |
| }, | |
| { | |
| key = "_", | |
| mods = "LEADER|SHIFT", | |
| -- action = act.SplitPane({ direction = "Down", size = { Percent = 50 }, domain = "CurrentPaneDomain" }), | |
| action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }), | |
| }, | |
| { key = "r", mods = "LEADER", action = act.ActivateKeyTable({ name = "resize_pane", one_shot = false }) }, | |
| { key = "x", mods = "LEADER", action = act.CloseCurrentPane({ confirm = true }) }, | |
| { | |
| key = "n", | |
| mods = "LEADER", | |
| action = act.PromptInputLine({ | |
| description = "Enter new name for tab", | |
| action = wezterm.action_callback(function(window, pane, line) | |
| if line then | |
| window:active_tab():set_title(line) | |
| end | |
| end), | |
| }), | |
| }, | |
| } | |
| config.launch_menu = {} | |
| for i, host in ipairs(ssh_hosts) do | |
| -- Define the command object based on the documentation's structure. | |
| local spawn_command = { | |
| label = host.label, | |
| args = host.args, | |
| set_environment_variables = {}, -- This is the critical fix. | |
| } | |
| -- 1. Add the correctly structured command to the launch menu. | |
| table.insert(config.launch_menu, spawn_command) | |
| -- 2. Pass the exact same structure to the SpawnCommandInNewTab action. | |
| table.insert(keys, { | |
| key = "F" .. i, | |
| mods = "CTRL|SHIFT", | |
| action = act.SpawnCommandInNewTab(spawn_command), | |
| }) | |
| end | |
| config.keys = keys | |
| --------------------------------------------------- | |
| -- Key Tables | |
| config.key_tables = { | |
| resize_pane = { | |
| { key = "LeftArrow", action = act.AdjustPaneSize({ "Left", 1 }) }, | |
| { key = "RightArrow", action = act.AdjustPaneSize({ "Right", 1 }) }, | |
| { key = "UpArrow", action = act.AdjustPaneSize({ "Up", 1 }) }, | |
| { key = "DownArrow", action = act.AdjustPaneSize({ "Down", 1 }) }, | |
| { key = "Escape", action = "PopKeyTable" }, | |
| }, | |
| } | |
| --------------------------------------------------- | |
| local mux = wezterm.mux | |
| wezterm.on("gui-startup", function(cmd) | |
| local tab, pane, window = mux.spawn_window(cmd or {}) | |
| window:gui_window():maximize() | |
| end) | |
| return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment