WezTerm

created: Fri, 03 Jan 2025 22:58:28 GMT, modified: Sun, 05 Jan 2025 16:35:25 GMT

WezTerm is a powerful cross-platform terminal emulator and multiplexer

See Phoenix for Quake-like console configuration.

Semantic Shell

Also known as OSC 133, allows scrolling to prompts and selecting whole command output at once. Requires shell integration script to markup prompts, inputs and outputs:

curl https://raw.githubusercontent.com/wez/wezterm/refs/heads/main/assets/shell-integration/wezterm.sh > ~/.config/wezterm/wezterm.sh

and source it in ~/.zshrc:

source ~/.config/wezterm/wezterm.sh

Configuration

$HOME/.config/wezterm/wezterm.lua:

local wezterm = require 'wezterm'
local config = wezterm.config_builder()
local act = wezterm.action

config.color_scheme = 'iTerm2 Pastel Dark Background'
config.font = wezterm.font 'Fira Code'
config.window_decorations = 'RESIZE'
config.font_size = 13.0
config.enable_tab_bar = true
config.disable_default_key_bindings = true
config.keys = {
  { mods = 'OPT', key = 'LeftArrow', action = act.SendString '\x1bb' },
  { mods = 'SUPER', key = 'LeftArrow', action = act.SendString '\x01' },
  { mods = 'OPT', key = 'RightArrow', action = act.SendString '\x1bf' },
  { mods = 'SUPER', key = 'RightArrow', action = act.SendString '\x05' },
  { mods = 'OPT', key = 'Backspace', action = act.SendString '\x17' },
  { mods = 'SUPER', key = 'Backspace', action = act.SendString '\x15' },
  { mods = 'SUPER', key = 't', action = act.SpawnTab 'DefaultDomain' },
  { mods = 'SUPER', key = 'w', action = act.CloseCurrentTab { confirm = false } },
  { mods = 'SUPER', key = 'c', action = act.CopyTo 'Clipboard' },
  { mods = 'SUPER', key = 'v', action = act.PasteFrom 'Clipboard' },
  { mods = 'SUPER', key = 'UpArrow', action = act.ScrollToPrompt(-1) },
  { mods = 'SUPER', key = 'DownArrow', action = act.ScrollToPrompt(1) },
}
config.mouse_bindings = {
  {
    mods = 'SUPER',
    event = { Up = { streak = 1, button = 'Left' } },
    action = wezterm.action.SelectTextAtMouseCursor 'SemanticZone',
  },
}
for i = 1, 9 do
  table.insert(config.keys, { mods = 'SUPER', key = tostring(i), action =  act.ActivateTab(i - 1)})
end
return config