feat(wezterm): :retab and improve URL regex

This commit is contained in:
reo101 2023-07-13 14:27:45 +03:00
parent f2519d6b71
commit 319817b5c0
Signed by: reo101
GPG key ID: 675AA7EF13964ACB

View file

@ -11,20 +11,20 @@ M.font = wezterm.font("FiraCode Nerd Font Mono")
-- Font options -- -- Font options --
------------------ ------------------
M.harfbuzz_features = { M.harfbuzz_features = {
"liga", "liga",
"cv02", "cv02",
"cv19", "cv19",
"cv25", "cv25",
"cv26", "cv26",
"cv28", "cv28",
"cv30", "cv30",
"cv32", "cv32",
"ss02", "ss02",
"ss03", "ss03",
"ss05", "ss05",
"ss07", "ss07",
"ss09", "ss09",
"zero", "zero",
} }
-------------------- --------------------
@ -49,10 +49,10 @@ M.use_resize_increments = false
M.enable_scroll_bar = false M.enable_scroll_bar = false
M.adjust_window_size_when_changing_font_size = false M.adjust_window_size_when_changing_font_size = false
M.window_padding = { M.window_padding = {
left = 0, left = 0,
right = 0, right = 0,
top = 0, top = 0,
bottom = 0, bottom = 0,
} }
------------- -------------
@ -64,65 +64,71 @@ M.enable_tab_bar = false
-- Keybinds -- -- Keybinds --
-------------- --------------
local function keybind(mods, key, action) local function keybind(mods, key, action)
if type(action) == "table" then if type(action) == "table" then
action = wezterm.action(action) action = wezterm.action(action)
end end
return { return {
mods = mods, mods = mods,
key = key, key = key,
action = action, action = action,
} }
end end
M.disable_default_key_bindings = true M.disable_default_key_bindings = true
M.keys = { M.keys = {
--------------- ---------------
-- Clipboard -- -- Clipboard --
--------------- ---------------
keybind("ALT", "c", { CopyTo = "Clipboard" }), keybind("ALT", "c", { CopyTo = "Clipboard" }),
keybind("ALT", "v", { PasteFrom = "Clipboard" }), keybind("ALT", "v", { PasteFrom = "Clipboard" }),
--------------- ---------------
-- Font size -- -- Font size --
--------------- ---------------
keybind("ALT|SHIFT", "UpArrow", "IncreaseFontSize"), keybind("ALT|SHIFT", "UpArrow", "IncreaseFontSize"),
keybind("ALT|SHIFT", "DownArrow", "DecreaseFontSize"), keybind("ALT|SHIFT", "DownArrow", "DecreaseFontSize"),
------------ ------------
-- Scroll -- -- Scroll --
------------ ------------
keybind("ALT", "u", { ScrollByPage = -1 }), keybind("ALT", "u", { ScrollByPage = -1 }),
keybind("ALT", "d", { ScrollByPage = 1 }), keybind("ALT", "d", { ScrollByPage = 1 }),
------------ ------------
-- Reload -- -- Reload --
------------ ------------
keybind("CTRL|SHIFT", "r", "ReloadConfiguration"), keybind("CTRL|SHIFT", "r", "ReloadConfiguration"),
} }
----------- -----------
-- Links -- -- Links --
----------- -----------
M.hyperlink_rules = { M.hyperlink_rules = {
-- Linkify things that look like URLs -- -- Linkify things that look like URLs
-- This is actually the default if you don't specify any hyperlink_rules -- -- This is actually the default if you don't specify any hyperlink_rules
{ -- {
regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b", -- regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
format = "$0", -- format = "$0",
}, -- },
-- linkify email addresses -- Linkify things that look like URLs
{ {
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b", regex = "\\b\\w+://(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&/=]*)",
format = "mailto:$0", format = "$0",
}, },
-- file:// URI -- linkify email addresses
{ {
regex = "\\bfile://\\S*\\b", regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "$0", format = "mailto:$0",
}, },
-- file:// URI
{
regex = "\\bfile://\\S*\\b",
format = "$0",
},
} }
return M return M