diff --git a/plugins/hyperlinks.lua b/plugins/hyperlinks.lua index 9212234..532f456 100644 --- a/plugins/hyperlinks.lua +++ b/plugins/hyperlinks.lua @@ -5,7 +5,42 @@ local M = {} -- Hyperlink Rules -CONFIG.hyperlink_rules = WEZTERM.default_hyperlink_rules() +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: + { + regex = "<(\\w+://\\S+)>", + format = "$1", + highlight = 1, + }, + -- implicit mailto link + { + regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b", + format = "mailto:$0", + }, + -- Then handle URLs not wrapped in brackets + { + regex = "\\w+://[^\\s\\]})(]+", + format = "$0", + }, +} -- Add support for GitHub link style