make links clickable

This commit is contained in:
Jesse Hitch 2023-03-03 09:15:39 +01:00
parent fe10d124d9
commit 634af46ee7

View file

@ -1,14 +1,24 @@
local wezterm = require 'wezterm'
return {
warn_about_missing_glyphs = false,
-- never play a bell sound
audible_bell = "Disabled",
-- initial size of the terminal
initial_cols = 162,
initial_rows = 50,
-- don't complain if an icon or character is missing
warn_about_missing_glyphs = false,
font_size = 15,
-- window look and feel
hide_tab_bar_if_only_one_tab = true,
window_decorations = "RESIZE",
-- transparency
window_background_opacity = 0.95,
-- key mappings
keys = {
-- This will create a new split and run your default program inside it
{
@ -17,6 +27,7 @@ return {
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
},
-- default terminal colors
colors = {
background = '#232336',
@ -63,4 +74,53 @@ return {
'#dadfe0',
},
},
-- make clickable hyperlinks work
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 task numbers clickable
-- The first matched regex group is captured in $1.
{
regex = [[\b[tT](\d+)\b]],
format = 'https://example.com/tasks/?t=$1',
},
-- Make username/project paths clickable. This implies paths like the following are for GitHub.
-- ( "nvim-treesitter/nvim-treesitter" | wbthomason/packer.nvim | wez/wezterm | "wez/wezterm.git" )
-- 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',
},
},
}