Skip to content

Instantly share code, notes, and snippets.

@shunia
Last active December 10, 2025 07:04
Show Gist options
  • Select an option

  • Save shunia/bd1152054637d5b69ba73631df66aeee to your computer and use it in GitHub Desktop.

Select an option

Save shunia/bd1152054637d5b69ba73631df66aeee to your computer and use it in GitHub Desktop.
WezTerm config
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- default theme
config.color_scheme = 'Vs Code Dark+ (Gogh)'
-- custom key bindings
config.keys = {
-- show launcher menu
{ key = 'l', mods = 'CTRL', action = act.ShowLauncher },
-- spawn a new tab with the current domain
{ key = 't', mods = 'CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
-- This will create a new split and run your default program inside it
{ key = 'w', mods = 'CTRL|SHIFT', action = act.SplitPane { direction = 'Up' } },
{ key = 's', mods = 'CTRL|SHIFT', action = act.SplitPane { direction = 'Down' } },
{ key = 'a', mods = 'CTRL|SHIFT', action = act.SplitPane { direction = 'Left' } },
{ key = 'd', mods = 'CTRL|SHIFT', action = act.SplitPane { direction = 'Right' } },
-- close current pane
{ key = 'w', mods = 'CTRL', action = act.CloseCurrentPane { confirm = true } },
}
-- activate tab key with ALT + n
for i = 1, 8 do
table.insert(config.keys, {
key = tostring(i),
mods = 'ALT',
action = act.ActivateTab(i - 1),
})
end
config.mouse_bindings = {
-- right click copy with selection, or paste without selection
{
event = { Down = { streak = 1, button = "Right" } },
mods = "NONE",
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then
window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(act.ClearSelection, pane)
else
window:perform_action(act({ PasteFrom = "Clipboard" }), pane)
end
end),
},
}
-- 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