feat: improve hyperlink matching with regular expressions
This commit is contained in:
+36
-1
@@ -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: <URL>
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user