Skip to content

Instantly share code, notes, and snippets.

@giacomorebonato
Created November 7, 2025 09:38
Show Gist options
  • Select an option

  • Save giacomorebonato/788d002c2de9d997921d5a22576fb763 to your computer and use it in GitHub Desktop.

Select an option

Save giacomorebonato/788d002c2de9d997921d5a22576fb763 to your computer and use it in GitHub Desktop.
wezterm
local wezterm = require 'wezterm'
local action = wezterm.action
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- Notification when the configuration is reloaded
local function toast(window, message)
window:toast_notification('wezterm', message .. ' - ' .. os.date('%I:%M:%S %p'), nil, 1000)
end
config.window_close_confirmation = "NeverPrompt"
config.color_scheme = 'Catppuccin Macchiato (Gogh)'
-- Use the defaults as a base
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- Make IP addresses with port clickable (e.g., 127.0.0.1:5053)
table.insert(config.hyperlink_rules, {
regex = [[\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d+)\b]],
format = 'http://$1:$2'
})
-- Match local file paths ending in .html
table.insert(config.hyperlink_rules, {
regex = [[\b(?:[a-zA-Z0-9_-]+(?:/[a-zA-Z0-9_-]+)*)+\.html\b]],
format = 'file://$0'
})
local bind = function(mods, key, action)
table.insert(config.keys, {
key = key,
mods = mods,
action = action
})
end
config.keys = {{
mods = "OPT",
key = "LeftArrow",
action = action.SendKey({
mods = "ALT",
key = "b"
})
}, {
mods = "OPT",
key = "RightArrow",
action = action.SendKey({
mods = "ALT",
key = "f"
})
}, {
mods = "CMD",
key = "LeftArrow",
action = action.SendKey({
mods = "CTRL",
key = "a"
})
}, {
mods = "CMD",
key = "RightArrow",
action = action.SendKey({
mods = "CTRL",
key = "e"
})
}, {
mods = "CMD",
key = "Backspace",
action = action.SendKey({
mods = "CTRL",
key = "u"
})
}, {
mods = 'CMD|ALT',
key = 'LeftArrow',
action = act.ActivateTabRelative(-1)
}, {
mods = 'CMD|ALT',
key = 'RightArrow',
action = act.ActivateTabRelative(1)
}}
bind('CMD', 'k', act.Multiple {act.ClearScrollback 'ScrollbackAndViewport', act.SendKey {
key = 'L',
mods = 'CTRL'
}})
bind('CMD', 'd', wezterm.action.SplitHorizontal {
domain = 'CurrentPaneDomain'
})
bind('CMD|SHIFT', 'd', wezterm.action.SplitVertical {
domain = 'CurrentPaneDomain'
})
bind('CMD', 'w', act.CloseCurrentPane {
confirm = false
})
-- Navigate between panes
bind('CMD', '[', act.ActivatePaneDirection 'Prev')
bind('CMD', ']', act.ActivatePaneDirection 'Next')
-- Resize panes with Hyper key (CMD + SHIFT + OPT + CTRL)
bind('CMD|SHIFT|OPT|CTRL', '=', act.AdjustPaneSize { 'Right', 5 })
bind('CMD|SHIFT|OPT|CTRL', '-', act.AdjustPaneSize { 'Left', 5 })
bind('CMD|SHIFT|OPT|CTRL', '9', act.AdjustPaneSize { 'Up', 5 })
bind('CMD|SHIFT|OPT|CTRL', '0', act.AdjustPaneSize { 'Down', 5 })
wezterm.on('window-config-reloaded', function(window, pane)
toast(window, 'Configuration reloaded!')
end)
-- and finally, return the configuration to wezterm
return config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment