Skip to content

Instantly share code, notes, and snippets.

@nico01f
Created August 6, 2024 17:34
Show Gist options
  • Save nico01f/38b33dad5bcc708411a6d492a87b190a to your computer and use it in GitHub Desktop.
Save nico01f/38b33dad5bcc708411a6d492a87b190a to your computer and use it in GitHub Desktop.
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices
config.default_cursor_style = 'BlinkingBlock'
config.colors = {
cursor_bg = '#82E0AA',
}
config.initial_cols = 98
config.initial_rows = 30
config.hide_tab_bar_if_only_one_tab = true
config.color_scheme = 'Dracula'
config.enable_scroll_bar = true
config.scrollback_lines = 10000
config.font = wezterm.font {
family = 'Cascadia Code',
harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
}
config.font_size = 14.5
config.hyperlink_rules = {
-- Matches: a URL in parens: (URL)
{
regex = '\\((\\w+://\\S+)\\)',
format = '$1',
highlight = 1,
},
-- Matches: a URL in brackets: [URL]
{
regex = '\\[(\\w+://\\S+)\\]',
format = '$1',
highlight = 1,
},
-- Matches: a URL in curly braces: {URL}
{
regex = '\\{(\\w+://\\S+)\\}',
format = '$1',
highlight = 1,
},
-- Matches: a URL in angle brackets: <URL>
{
regex = '<(\\w+://\\S+)>',
format = '$1',
highlight = 1,
},
-- Then handle URLs not wrapped in brackets
{
regex = '\\b\\w+://\\S+[)/a-zA-Z0-9-]+',
format = '$0',
},
-- implicit mailto link
{
regex = '\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b',
format = 'mailto:$0',
},
}
config.keys = {
{ mods = "OPT", key = "LeftArrow", action = act.SendKey({ mods = "ALT", key = "b" }) },
{ mods = "OPT", key = "RightArrow", action = act.SendKey({ mods = "ALT", key = "f" }) },
{ mods = "CMD", key = "LeftArrow", action = act.SendKey({ mods = "CTRL", key = "a" }) },
{ mods = "CMD", key = "RightArrow", action = act.SendKey({ mods = "CTRL", key = "e" }) },
{ mods = "CMD", key = "Backspace", action = act.SendKey({ mods = "CTRL", key = "u" }) },
{ mods = "CMD|OPT", key = "LeftArrow", action = act.ActivateTabRelative(-1) },
{ mods = "CMD|OPT", key = "RightArrow", action = act.ActivateTabRelative(1) },
{ mods = "CMD|SHIFT", key = "LeftArrow", action = act.ActivateTabRelative(-1) },
{ mods = "CMD|SHIFT", key = "RightArrow", action = act.ActivateTabRelative(1) },
}
-- 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