From e3c546196820c71c0211b279cb0f6121dfe730bf Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:20:06 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(wezterm):=20Linkies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/wezterm/wezterm.lua | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.config/wezterm/wezterm.lua b/.config/wezterm/wezterm.lua index e7a86e5..fb629e1 100644 --- a/.config/wezterm/wezterm.lua +++ b/.config/wezterm/wezterm.lua @@ -33,4 +33,44 @@ config.font = wezterm.font_with_fallback({ }) config.font_size = 11.0 +config.hyperlink_rules = { + -- Linkify things that look like URLs and the host has a TLD name. + -- + -- Compiled-in default. Used if you don't specify any hyperlink_rules. + { + regex = "\\b\\w+://[\\w.-]+\\.[a-z]{2,15}\\S*\\b", + format = "$0", + }, + + -- linkify email addresses + -- Compiled-in default. Used if you don't specify any hyperlink_rules. + { + regex = [[\b\w+@[\w-]+(\.[\w-]+)+\b]], + format = "mailto:$0", + }, + + -- file:// URI + -- Compiled-in default. Used if you don't specify any hyperlink_rules. + { + regex = [[\bfile://\S*\b]], + format = "$0", + }, + + -- Linkify things that look like URLs with numeric addresses as hosts. + -- E.g. http://127.0.0.1:8000 for a local development server, + -- or http://192.168.1.1 for the web interface of many routers. + { + regex = [[\b\w+://(?:[\d]{1,3}\.){3}[\d]{1,3}\S*\b]], + format = "$0", + }, + + -- Make username/project paths clickable. This implies paths like the following are for GitHub. + -- As long as a full URL hyperlink regex exists above this it should not match a full URL to + -- GitHub or GitLab / BitBucket (i.e. https://gitlab.com/user/project.git is still a whole clickable URL) + { + regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]], + format = "https://www.github.com/$1/$3", + }, +} + return config