Skip to content

Instantly share code, notes, and snippets.

@spartanatreyu
Last active August 21, 2024 06:08
Show Gist options
  • Save spartanatreyu/fe6d045c3113f27acaa509c3fdc6b736 to your computer and use it in GitHub Desktop.
Save spartanatreyu/fe6d045c3113f27acaa509c3fdc6b736 to your computer and use it in GitHub Desktop.
Personal terminal config (wezterm)
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
-----------------------------------------
-- Terminal Controls --
-----------------------------------------
-- Mac/Emacs style Cursor jumping
local action = wezterm.action
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 = "ALT", key = "w" }) },
}
-- CMD + Left Click to follow Hyperlinks
config.mouse_bindings = {
-- Change the default click behavior so that it only selects
-- text and doesn't open hyperlinks
{
event = { Up = { streak = 1, button = 'Left' } },
mods = 'NONE',
action = wezterm.action.CompleteSelection 'ClipboardAndPrimarySelection'
},
-- and make CMD-Click open hyperlinks
{
event = { Up = { streak = 1, button = 'Left' } },
mods = 'CMD',
action = wezterm.action.OpenLinkAtMouseCursor
},
-- NOTE that binding only the 'Up' event can give unexpected behaviors.
-- Disable the 'Down' event of CMD-Click to avoid weird program behaviors
--
-- Reason: if we only set it on the mouse up event, programs with mouse support like vim, helix,
-- etc... would get the mouse down event (e.g. to start highlighting text) but the mouse up
-- event would never arrive because it would be captured by wezterm. So we need to ignore all
-- CMD + Mouse Down events to prevent those programs waiting for a mouse up event that would
-- never arrive.
{
event = { Down = { streak = 1, button = 'Left' } },
mods = 'CMD',
action = wezterm.action.Nop
}
}
----------------------------------------
-- Terminal Visuals --
----------------------------------------
-- Fonts
config.font = wezterm.font('MesloLGS NF')
config.font_size = 13
-- Window Decorations
config.window_decorations = "INTEGRATED_BUTTONS | RESIZE"
config.window_background_opacity = 0.9
config.macos_window_background_blur = 6
config.enable_scroll_bar = true
config.hide_mouse_cursor_when_typing = false
-- Colors
-- Start with a color scheme I like
config.color_scheme = 'Gruvbox Dark (Gogh)'
-- Make scrollbar visible
config.colors = {
scrollbar_thumb = "#AEB1AE"
}
-- Make dark text darker so it can be read on colored backgrounds
config.colors.brights = wezterm.color.get_builtin_schemes()['Gruvbox Dark (Gogh)'].brights
config.colors.brights[1] = '#666666'
return config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment