Initial WezTerm configuration
This commit is contained in:
@@ -27,6 +27,7 @@ Below is a list of the software:
|
|||||||
- Sway
|
- Sway
|
||||||
- Tmux
|
- Tmux
|
||||||
- Waybar
|
- Waybar
|
||||||
|
- Wezterm
|
||||||
- Yazi
|
- Yazi
|
||||||
- Zellij
|
- Zellij
|
||||||
- Zoxide
|
- Zoxide
|
||||||
|
|||||||
4
wezterm/.config/wezterm/.gitignore
vendored
Normal file
4
wezterm/.config/wezterm/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/luarocks.bat
|
||||||
|
/lua.bat
|
||||||
|
/lua_modules
|
||||||
|
/.luarocks
|
||||||
3
wezterm/.config/wezterm/.luarc.json
Normal file
3
wezterm/.config/wezterm/.luarc.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"workspace.checkThirdParty": false
|
||||||
|
}
|
||||||
6
wezterm/.config/wezterm/.stylua.toml
Normal file
6
wezterm/.config/wezterm/.stylua.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
column_width = 100
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 3
|
||||||
|
quote_style = "AutoPreferSingle"
|
||||||
|
call_parentheses = "Always"
|
||||||
94
wezterm/.config/wezterm/colors/custom.lua
Normal file
94
wezterm/.config/wezterm/colors/custom.lua
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
-- A slightly altered version of catppucchin mocha
|
||||||
|
-- please check: https://wezfurlong.org/wezterm/config/appearance.html
|
||||||
|
local mocha = {
|
||||||
|
rosewater = '#f5e0dc',
|
||||||
|
flamingo = '#f2cdcd',
|
||||||
|
pink = '#f5c2e7',
|
||||||
|
mauve = '#cba6f7',
|
||||||
|
red = '#f38ba8',
|
||||||
|
maroon = '#eba0ac',
|
||||||
|
peach = '#fab387',
|
||||||
|
yellow = '#f9e2af',
|
||||||
|
green = '#a6e3a1',
|
||||||
|
teal = '#94e2d5',
|
||||||
|
sky = '#89dceb',
|
||||||
|
sapphire = '#74c7ec',
|
||||||
|
blue = '#89b4fa',
|
||||||
|
lavender = '#b4befe',
|
||||||
|
text = '#cdd6f4',
|
||||||
|
subtext1 = '#bac2de',
|
||||||
|
subtext0 = '#a6adc8',
|
||||||
|
overlay2 = '#9399b2',
|
||||||
|
overlay1 = '#7f849c',
|
||||||
|
overlay0 = '#6c7086',
|
||||||
|
surface2 = '#585b70',
|
||||||
|
surface1 = '#45475a',
|
||||||
|
surface0 = '#313244',
|
||||||
|
base = '#1f1f28',
|
||||||
|
mantle = '#181825',
|
||||||
|
crust = '#11111b',
|
||||||
|
}
|
||||||
|
|
||||||
|
local colorscheme = {
|
||||||
|
foreground = mocha.text,
|
||||||
|
background = mocha.base,
|
||||||
|
cursor_bg = mocha.rosewater,
|
||||||
|
cursor_border = mocha.rosewater,
|
||||||
|
cursor_fg = mocha.crust,
|
||||||
|
selection_bg = mocha.surface2,
|
||||||
|
selection_fg = mocha.text,
|
||||||
|
ansi = {
|
||||||
|
'#282828', -- black
|
||||||
|
'#cc241d', -- red
|
||||||
|
'#98971a', -- green
|
||||||
|
'#d79921', -- yellow
|
||||||
|
'#458588', -- blue
|
||||||
|
'#b16286', -- magenta/purple
|
||||||
|
'#3A96DD', -- cyan
|
||||||
|
'#CCCCCC', -- white
|
||||||
|
},
|
||||||
|
brights = {
|
||||||
|
'#767676', -- black
|
||||||
|
'#E74856', -- red
|
||||||
|
'#16C60C', -- green
|
||||||
|
'#F9F1A5', -- yellow
|
||||||
|
'#3B78FF', -- blue
|
||||||
|
'#B4009E', -- magenta/purple
|
||||||
|
'#61D6D6', -- cyan
|
||||||
|
'#F2F2F2', -- white
|
||||||
|
},
|
||||||
|
tab_bar = {
|
||||||
|
background = '#000000',
|
||||||
|
active_tab = {
|
||||||
|
bg_color = mocha.surface2,
|
||||||
|
fg_color = mocha.text,
|
||||||
|
},
|
||||||
|
inactive_tab = {
|
||||||
|
bg_color = mocha.surface0,
|
||||||
|
fg_color = mocha.subtext1,
|
||||||
|
},
|
||||||
|
inactive_tab_hover = {
|
||||||
|
bg_color = mocha.surface0,
|
||||||
|
fg_color = mocha.text,
|
||||||
|
},
|
||||||
|
new_tab = {
|
||||||
|
bg_color = mocha.base,
|
||||||
|
fg_color = mocha.text,
|
||||||
|
},
|
||||||
|
new_tab_hover = {
|
||||||
|
bg_color = mocha.mantle,
|
||||||
|
fg_color = mocha.text,
|
||||||
|
italic = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
visual_bell = mocha.surface0,
|
||||||
|
indexed = {
|
||||||
|
[16] = mocha.peach,
|
||||||
|
[17] = mocha.rosewater,
|
||||||
|
},
|
||||||
|
scrollbar_thumb = mocha.surface2,
|
||||||
|
split = mocha.overlay0,
|
||||||
|
compose_cursor = mocha.flamingo, -- nightbuild only
|
||||||
|
}
|
||||||
|
|
||||||
|
return colorscheme
|
||||||
87
wezterm/.config/wezterm/config/appearance.lua
Normal file
87
wezterm/.config/wezterm/config/appearance.lua
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
local colors = require('colors.custom')
|
||||||
|
local platform = require('utils.platform')()
|
||||||
|
|
||||||
|
local config = {}
|
||||||
|
if platform.is_mac then
|
||||||
|
config.button_style = 'MacOsNative'
|
||||||
|
config.button_alignment = 'Left'
|
||||||
|
elseif platform.is_linux then
|
||||||
|
config.button_style = 'Gnome'
|
||||||
|
config.button_alignment = 'Right'
|
||||||
|
else
|
||||||
|
config.buttun_style = 'Windows'
|
||||||
|
config.button_alignment = 'Right'
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
term = 'xterm-256color',
|
||||||
|
animation_fps = 60,
|
||||||
|
max_fps = 60,
|
||||||
|
front_end = 'WebGpu',
|
||||||
|
webgpu_power_preference = 'HighPerformance',
|
||||||
|
warn_about_missing_glyphs = false,
|
||||||
|
|
||||||
|
-- color scheme
|
||||||
|
-- colors = colors, if you want to setting your color custom
|
||||||
|
color_scheme = 'Gruvbox dark, medium (base16)',
|
||||||
|
|
||||||
|
-- Set to deault rows and columns
|
||||||
|
initial_cols = 140,
|
||||||
|
initial_rows = 35,
|
||||||
|
|
||||||
|
-- background
|
||||||
|
window_background_opacity = 0.80,
|
||||||
|
win32_system_backdrop = 'Acrylic',
|
||||||
|
background = {
|
||||||
|
{
|
||||||
|
source = { Color = '#1d2021' },
|
||||||
|
height = '100%',
|
||||||
|
width = '100%',
|
||||||
|
opacity = 0.90,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- scrollbar
|
||||||
|
enable_scroll_bar = true,
|
||||||
|
min_scroll_bar_height = '3cell',
|
||||||
|
colors = {
|
||||||
|
scrollbar_thumb = '#34354D',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- tab bar
|
||||||
|
enable_tab_bar = true,
|
||||||
|
hide_tab_bar_if_only_one_tab = false,
|
||||||
|
use_fancy_tab_bar = true,
|
||||||
|
tab_max_width = 25,
|
||||||
|
show_tab_index_in_tab_bar = true,
|
||||||
|
switch_to_last_active_tab_when_closing_tab = true,
|
||||||
|
|
||||||
|
-- cursor
|
||||||
|
default_cursor_style = 'BlinkingBlock',
|
||||||
|
cursor_blink_ease_in = 'Constant',
|
||||||
|
cursor_blink_ease_out = 'Constant',
|
||||||
|
cursor_blink_rate = 0,
|
||||||
|
|
||||||
|
-- window
|
||||||
|
adjust_window_size_when_changing_font_size = true,
|
||||||
|
window_decorations = 'INTEGRATED_BUTTONS|RESIZE',
|
||||||
|
integrated_title_button_style = config.button_style,
|
||||||
|
integrated_title_button_color = '#282828',
|
||||||
|
integrated_title_button_alignment = config.button_alignment,
|
||||||
|
|
||||||
|
window_padding = {
|
||||||
|
left = 5,
|
||||||
|
right = 10,
|
||||||
|
top = 12,
|
||||||
|
bottom = 7,
|
||||||
|
},
|
||||||
|
window_close_confirmation = 'AlwaysPrompt',
|
||||||
|
window_frame = {
|
||||||
|
active_titlebar_bg = '#282828',
|
||||||
|
inactive_titlebar_bg = '#282828',
|
||||||
|
-- font = fonts.font,
|
||||||
|
-- font_size = fonts.font_size,
|
||||||
|
},
|
||||||
|
inactive_pane_hsb = { saturation = 1.0, brightness = 1.0 },
|
||||||
|
}
|
||||||
207
wezterm/.config/wezterm/config/bindings.lua
Normal file
207
wezterm/.config/wezterm/config/bindings.lua
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
local platform = require('utils.platform')()
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
|
local mod = {}
|
||||||
|
|
||||||
|
if platform.is_mac then
|
||||||
|
mod.SUPER = 'SUPER'
|
||||||
|
mod.SUPER_REV = 'SUPER|CTRL'
|
||||||
|
elseif platform.is_win or platform.is_linux then
|
||||||
|
mod.SUPER = 'ALT' -- to not conflict with Windows key shortcuts
|
||||||
|
mod.SUPER_REV = 'ALT|CTRL'
|
||||||
|
end
|
||||||
|
|
||||||
|
local keys = {
|
||||||
|
-- misc/useful --
|
||||||
|
{ key = 'F1', mods = 'NONE', action = 'ActivateCopyMode' },
|
||||||
|
{ key = 'F2', mods = 'NONE', action = act.ActivateCommandPalette },
|
||||||
|
{ key = 'F3', mods = 'NONE', action = act.ShowLauncher },
|
||||||
|
{ key = 'F4', mods = 'NONE', action = act.ShowTabNavigator },
|
||||||
|
{ key = 'F11', mods = 'NONE', action = act.ToggleFullScreen },
|
||||||
|
{ key = 'F12', mods = 'NONE', action = act.ShowDebugOverlay },
|
||||||
|
{ key = 'f', mods = mod.SUPER, action = act.Search({ CaseInSensitiveString = '' }) },
|
||||||
|
|
||||||
|
-- copy/paste --
|
||||||
|
{ key = 'c', mods = 'CTRL|SHIFT', action = act.CopyTo('Clipboard') },
|
||||||
|
{ key = 'v', mods = 'CTRL|SHIFT', action = act.PasteFrom('Clipboard') },
|
||||||
|
|
||||||
|
-- tabs --
|
||||||
|
-- tabs: spawn+close
|
||||||
|
{ key = 't', mods = mod.SUPER, action = act.SpawnTab('DefaultDomain') },
|
||||||
|
{ key = 't', mods = mod.SUPER_REV, action = act.SpawnTab({ DomainName = 'WSL:Ubuntu' }) },
|
||||||
|
{ key = 'w', mods = mod.SUPER_REV, action = act.CloseCurrentTab({ confirm = false }) },
|
||||||
|
|
||||||
|
-- tabs: navigation
|
||||||
|
{ key = '[', mods = mod.SUPER, action = act.ActivateTabRelative(-1) },
|
||||||
|
{ key = ']', mods = mod.SUPER, action = act.ActivateTabRelative(1) },
|
||||||
|
{ key = '[', mods = mod.SUPER_REV, action = act.MoveTabRelative(-1) },
|
||||||
|
{ key = ']', mods = mod.SUPER_REV, action = act.MoveTabRelative(1) },
|
||||||
|
|
||||||
|
-- window --
|
||||||
|
-- spawn windows
|
||||||
|
{ key = 'n', mods = mod.SUPER, action = act.SpawnWindow },
|
||||||
|
|
||||||
|
-- panes --
|
||||||
|
-- panes: split panes
|
||||||
|
{
|
||||||
|
key = [[/]],
|
||||||
|
mods = mod.SUPER_REV,
|
||||||
|
action = act.SplitVertical({ domain = 'CurrentPaneDomain' }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = [[\]],
|
||||||
|
mods = mod.SUPER_REV,
|
||||||
|
action = act.SplitHorizontal({ domain = 'CurrentPaneDomain' }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = [[-]],
|
||||||
|
mods = mod.SUPER_REV,
|
||||||
|
action = act.CloseCurrentPane({ confirm = true }),
|
||||||
|
},
|
||||||
|
|
||||||
|
-- panes: zoom+close pane
|
||||||
|
{ key = 'z', mods = mod.SUPER_REV, action = act.TogglePaneZoomState },
|
||||||
|
{ key = 'w', mods = mod.SUPER, action = act.CloseCurrentPane({ confirm = false }) },
|
||||||
|
|
||||||
|
-- panes: navigation
|
||||||
|
{ key = 'k', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Up') },
|
||||||
|
{ key = 'j', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Down') },
|
||||||
|
{ key = 'h', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Left') },
|
||||||
|
{ key = 'l', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Right') },
|
||||||
|
|
||||||
|
-- panes: resize
|
||||||
|
{ key = 'UpArrow', mods = mod.SUPER_REV, action = act.AdjustPaneSize({ 'Up', 1 }) },
|
||||||
|
{ key = 'DownArrow', mods = mod.SUPER_REV, action = act.AdjustPaneSize({ 'Down', 1 }) },
|
||||||
|
{ key = 'LeftArrow', mods = mod.SUPER_REV, action = act.AdjustPaneSize({ 'Left', 1 }) },
|
||||||
|
{ key = 'RightArrow', mods = mod.SUPER_REV, action = act.AdjustPaneSize({ 'Right', 1 }) },
|
||||||
|
|
||||||
|
-- fonts --
|
||||||
|
-- fonts: resize
|
||||||
|
{ key = 'UpArrow', mods = mod.SUPER, action = act.IncreaseFontSize },
|
||||||
|
{ key = 'DownArrow', mods = mod.SUPER, action = act.DecreaseFontSize },
|
||||||
|
{ key = 'r', mods = mod.SUPER, action = act.ResetFontSize },
|
||||||
|
|
||||||
|
-- key-tables --
|
||||||
|
-- resizes fonts
|
||||||
|
{
|
||||||
|
key = 'f',
|
||||||
|
mods = 'LEADER',
|
||||||
|
action = act.ActivateKeyTable({
|
||||||
|
name = 'resize_font',
|
||||||
|
one_shot = false,
|
||||||
|
timemout_miliseconds = 1000,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
-- resize panes
|
||||||
|
{
|
||||||
|
key = 'p',
|
||||||
|
mods = 'LEADER',
|
||||||
|
action = act.ActivateKeyTable({
|
||||||
|
name = 'resize_pane',
|
||||||
|
one_shot = false,
|
||||||
|
timemout_miliseconds = 1000,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
-- rename tab bar
|
||||||
|
{
|
||||||
|
key = 'R',
|
||||||
|
mods = 'CTRL|SHIFT',
|
||||||
|
action = act.PromptInputLine({
|
||||||
|
description = 'Enter new name for tab',
|
||||||
|
action = wezterm.action_callback(function(window, pane, line)
|
||||||
|
-- line will be `nil` if they hit escape without entering anything
|
||||||
|
-- An empty string if they just hit enter
|
||||||
|
-- Or the actual line of text they wrote
|
||||||
|
if line then
|
||||||
|
window:active_tab():set_title(line)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local key_tables = {
|
||||||
|
resize_font = {
|
||||||
|
{ key = 'k', action = act.IncreaseFontSize },
|
||||||
|
{ key = 'j', action = act.DecreaseFontSize },
|
||||||
|
{ key = 'r', action = act.ResetFontSize },
|
||||||
|
{ key = 'Escape', action = 'PopKeyTable' },
|
||||||
|
{ key = 'q', action = 'PopKeyTable' },
|
||||||
|
},
|
||||||
|
resize_pane = {
|
||||||
|
{ key = 'k', action = act.AdjustPaneSize({ 'Up', 1 }) },
|
||||||
|
{ key = 'j', action = act.AdjustPaneSize({ 'Down', 1 }) },
|
||||||
|
{ key = 'h', action = act.AdjustPaneSize({ 'Left', 1 }) },
|
||||||
|
{ key = 'l', action = act.AdjustPaneSize({ 'Right', 1 }) },
|
||||||
|
{ key = 'Escape', action = 'PopKeyTable' },
|
||||||
|
{ key = 'q', action = 'PopKeyTable' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local mouse_bindings = {
|
||||||
|
-- Ctrl-click will open the link under the mouse cursor
|
||||||
|
{
|
||||||
|
event = { Up = { streak = 1, button = 'Left' } },
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = act.OpenLinkAtMouseCursor,
|
||||||
|
},
|
||||||
|
-- Move mouse will only select text and not copy text to clipboard
|
||||||
|
{
|
||||||
|
event = { Down = { streak = 1, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.SelectTextAtMouseCursor('Cell'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { Up = { streak = 1, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.ExtendSelectionToMouseCursor('Cell'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { Drag = { streak = 1, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.ExtendSelectionToMouseCursor('Cell'),
|
||||||
|
},
|
||||||
|
-- Triple Left click will select a line
|
||||||
|
{
|
||||||
|
event = { Down = { streak = 3, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.SelectTextAtMouseCursor('Line'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { Up = { streak = 3, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.SelectTextAtMouseCursor('Line'),
|
||||||
|
},
|
||||||
|
-- Double Left click will select a word
|
||||||
|
{
|
||||||
|
event = { Down = { streak = 2, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.SelectTextAtMouseCursor('Word'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { Up = { streak = 2, button = 'Left' } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.SelectTextAtMouseCursor('Word'),
|
||||||
|
},
|
||||||
|
-- Turn on the mouse wheel to scroll the screen
|
||||||
|
{
|
||||||
|
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.ScrollByCurrentEventWheelDelta,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
|
||||||
|
mods = 'NONE',
|
||||||
|
action = act.ScrollByCurrentEventWheelDelta,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
disable_default_key_bindings = true,
|
||||||
|
disable_default_mouse_bindings = true,
|
||||||
|
leader = { key = 'Space', mods = 'CTRL|SHIFT' },
|
||||||
|
keys = keys,
|
||||||
|
key_tables = key_tables,
|
||||||
|
mouse_bindings = mouse_bindings,
|
||||||
|
}
|
||||||
5
wezterm/.config/wezterm/config/domains.lua
Normal file
5
wezterm/.config/wezterm/config/domains.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-- Please check https://wezfurlong.org/wezterm/config/lua/SshDomain.html
|
||||||
|
|
||||||
|
return {
|
||||||
|
ssh_domains = {},
|
||||||
|
}
|
||||||
14
wezterm/.config/wezterm/config/fonts.lua
Normal file
14
wezterm/.config/wezterm/config/fonts.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
|
||||||
|
return {
|
||||||
|
font = wezterm.font_with_fallback({
|
||||||
|
{ family = 'CaskaydiaMono Nerd Font Mono', weight = 'Regular' },
|
||||||
|
{ family = 'FiraCode Nerd Font', weight= 'Regular' },
|
||||||
|
{ family = 'JetBrainsMono Nerd Font', weight = 'Regular' },
|
||||||
|
}),
|
||||||
|
font_size = 16,
|
||||||
|
|
||||||
|
--ref: https://wezfurlong.org/wezterm/config/lua/config/freetype_pcf_long_family_names.html#why-doesnt-wezterm-use-the-distro-freetype-or-match-its-configuration
|
||||||
|
freetype_load_target = 'Normal', ---@type 'Normal'|'Light'|'Mono'|'HorizontalLcd'
|
||||||
|
freetype_render_target = 'Normal', ---@type 'Normal'|'Light'|'Mono'|'HorizontalLcd'
|
||||||
|
}
|
||||||
50
wezterm/.config/wezterm/config/general.lua
Normal file
50
wezterm/.config/wezterm/config/general.lua
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
return {
|
||||||
|
-- behaviours
|
||||||
|
automatically_reload_config = true,
|
||||||
|
check_for_updates = false,
|
||||||
|
exit_behavior = 'CloseOnCleanExit', -- if the shell program exited with a successful status
|
||||||
|
status_update_interval = 1000,
|
||||||
|
|
||||||
|
-- scrollbar
|
||||||
|
scrollback_lines = 5000,
|
||||||
|
|
||||||
|
-- paste behaviours
|
||||||
|
canonicalize_pasted_newlines = 'CarriageReturn',
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
-- Then handle URLs not wrapped in brackets
|
||||||
|
{
|
||||||
|
regex = '\\b\\w+://\\S+[)/a-zA-Z0-9-]+',
|
||||||
|
format = '$0',
|
||||||
|
},
|
||||||
|
-- implicit mailto link
|
||||||
|
{
|
||||||
|
regex = '\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b',
|
||||||
|
format = 'mailto:$0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
34
wezterm/.config/wezterm/config/init.lua
Normal file
34
wezterm/.config/wezterm/config/init.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
|
||||||
|
---@class Config
|
||||||
|
---@field options table
|
||||||
|
local Config = {}
|
||||||
|
|
||||||
|
---Initialize Config
|
||||||
|
---@return Config
|
||||||
|
function Config:init()
|
||||||
|
local o = {}
|
||||||
|
self = setmetatable(o, { __index = Config })
|
||||||
|
self.options = {}
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
---Append to `Config.options`
|
||||||
|
---@param new_options table new options to append
|
||||||
|
---@return Config
|
||||||
|
function Config:append(new_options)
|
||||||
|
for k, v in pairs(new_options) do
|
||||||
|
if self.options[k] ~= nil then
|
||||||
|
wezterm.log_warn(
|
||||||
|
'Duplicate config option detected: ',
|
||||||
|
{ old = self.options[k], new = new_options[k] }
|
||||||
|
)
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
|
self.options[k] = v
|
||||||
|
::continue::
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
return Config
|
||||||
34
wezterm/.config/wezterm/config/launch.lua
Normal file
34
wezterm/.config/wezterm/config/launch.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
local platform = require('utils.platform')()
|
||||||
|
|
||||||
|
local options = {
|
||||||
|
default_prog = {},
|
||||||
|
launch_menu = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
if platform.is_win then
|
||||||
|
options.default_prog = { 'pwsh' }
|
||||||
|
options.launch_menu = {
|
||||||
|
{ label = 'PowerShell Core', args = { 'pwsh' } },
|
||||||
|
{ label = 'PowerShell Desktop', args = { 'powershell' } },
|
||||||
|
{
|
||||||
|
label = 'Git Bash',
|
||||||
|
args = { 'C:\\Program Files\\Git\\bin\\bash.exe' },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif platform.is_mac or platform.is_linux then
|
||||||
|
options.default_prog = { '/bin/zsh', '-l' }
|
||||||
|
options.launch_menu = {
|
||||||
|
{ label = 'Zsh', args = { 'zsh', '-l' } },
|
||||||
|
{ label = 'Bash', args = { 'bash', '-l' } },
|
||||||
|
{ label = 'Fish', args = { 'fish', '-l' } },
|
||||||
|
}
|
||||||
|
elseif platform.is_linux then
|
||||||
|
options.default_prog = { 'zsh', '-l' }
|
||||||
|
options.launch_menu = {
|
||||||
|
{ label = 'Zsh', args = { 'zsh', '-l' } },
|
||||||
|
{ label = 'Bash', args = { 'bash', '-l' } },
|
||||||
|
{ label = 'Fish', args = { 'fish', '-l' } },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return options
|
||||||
21
wezterm/.config/wezterm/events/new-tab-button.lua
Normal file
21
wezterm/.config/wezterm/events/new-tab-button.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
wezterm.on('new-tab-button-click', function(window, pane, button, default_action)
|
||||||
|
wezterm.log_info('new-tab', window, pane, button, default_action)
|
||||||
|
if default_action and button == 'Left' then
|
||||||
|
window:perform_action(default_action, pane)
|
||||||
|
end
|
||||||
|
|
||||||
|
if default_action and button == 'Right' then
|
||||||
|
window:perform_action(
|
||||||
|
wezterm.action.ShowLauncherArgs({ title = ' Select/Search:', flags = 'FUZZY|LAUNCH_MENU_ITEMS|DOMAINS'}), pane
|
||||||
|
)
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
76
wezterm/.config/wezterm/events/right-status.lua
Normal file
76
wezterm/.config/wezterm/events/right-status.lua
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
local math = require('utils.math')
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.separator_char = ' '
|
||||||
|
|
||||||
|
M.colors = {
|
||||||
|
date_fg = '#79740e',
|
||||||
|
date_bg = '#282828',
|
||||||
|
battery_fg = '#79740e',
|
||||||
|
battery_bg = '#282828',
|
||||||
|
separator_fg = '#786D22',
|
||||||
|
separator_bg = '#282828',
|
||||||
|
}
|
||||||
|
|
||||||
|
M.cells = {} -- wezterm FormatItems (ref: https://wezfurlong.org/wezterm/config/lua/wezterm/format.html)
|
||||||
|
|
||||||
|
---@param text string
|
||||||
|
---@param icon string
|
||||||
|
---@param fg string
|
||||||
|
---@param bg string
|
||||||
|
---@param separate boolean
|
||||||
|
M.push = function(text, icon, fg, bg, separate)
|
||||||
|
table.insert(M.cells, { Foreground = { Color = fg } })
|
||||||
|
table.insert(M.cells, { Background = { Color = bg } })
|
||||||
|
table.insert(M.cells, { Attribute = { Intensity = 'Bold' } })
|
||||||
|
table.insert(M.cells, { Text = icon .. ' ' .. text .. ' ' })
|
||||||
|
|
||||||
|
if separate then
|
||||||
|
table.insert(M.cells, { Foreground = { Color = M.colors.separator_fg } })
|
||||||
|
table.insert(M.cells, { Background = { Color = M.colors.separator_bg } })
|
||||||
|
table.insert(M.cells, { Text = M.separator_char })
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(M.cells, 'ResetAttributes')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.set_date = function()
|
||||||
|
local date = wezterm.strftime(' %a %H:%M')
|
||||||
|
M.push(date, '', M.colors.date_fg, M.colors.date_bg, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.set_battery = function()
|
||||||
|
-- ref: https://wezfurlong.org/wezterm/config/lua/wezterm/battery_info.html
|
||||||
|
local discharging_icons =
|
||||||
|
{ '', '', '', '', '', '', '', '', '', '' }
|
||||||
|
local charging_icons = { '', '', '', '', '', '', '', '', '', '' }
|
||||||
|
|
||||||
|
local charge = ''
|
||||||
|
local icon = '🔋'
|
||||||
|
|
||||||
|
for _, b in ipairs(wezterm.battery_info()) do
|
||||||
|
local idx = math.clamp(math.round(b.state_of_charge * 10), 1, 10)
|
||||||
|
charge = string.format('%.0f%%', b.state_of_charge * 100)
|
||||||
|
|
||||||
|
if b.state == 'Charging' then
|
||||||
|
icon = charging_icons[idx]
|
||||||
|
else
|
||||||
|
icon = discharging_icons[idx]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.push(charge, ' 🔋', M.colors.battery_fg, M.colors.battery_bg, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
wezterm.on('update-right-status', function(window)
|
||||||
|
M.cells = {}
|
||||||
|
M.set_date()
|
||||||
|
M.set_battery()
|
||||||
|
|
||||||
|
window:set_right_status(wezterm.format(M.cells))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
175
wezterm/.config/wezterm/events/tab-title.lua
Normal file
175
wezterm/.config/wezterm/events/tab-title.lua
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
local platform = require('utils.platform')()
|
||||||
|
|
||||||
|
-- Inspired by https://github.com/wez/wezterm/discussions/628#discussioncomment-1874614
|
||||||
|
|
||||||
|
local GLYPH_SEMI_CIRCLE_LEFT = ''
|
||||||
|
-- local GLYPH_SEMI_CIRCLE_LEFT = utf8.char(0xe0b6)
|
||||||
|
local GLYPH_SEMI_CIRCLE_RIGHT = ''
|
||||||
|
-- local GLYPH_SEMI_CIRCLE_RIGHT = utf8.char(0xe0b4)
|
||||||
|
local GLYPH_CIRCLE = '💤' --
|
||||||
|
-- local GLYPH_CIRCLE = utf8.char(0xf111)
|
||||||
|
local GLYPH_ADMIN = 'ﱾ'
|
||||||
|
-- local GLYPH_ADMIN = utf8.char(0xfc7e)
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.cells = {}
|
||||||
|
|
||||||
|
M.colors = {
|
||||||
|
default = {
|
||||||
|
bg = '#7c6f64',
|
||||||
|
fg = '#282828',
|
||||||
|
},
|
||||||
|
is_active = {
|
||||||
|
bg = '#d79921',
|
||||||
|
fg = '#282828',
|
||||||
|
},
|
||||||
|
hover = {
|
||||||
|
bg = '#d79921',
|
||||||
|
fg = '#282828',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M.set_process_name = function(s)
|
||||||
|
local a = string.gsub(s, '(.*[/\\])(.*)', '%2')
|
||||||
|
return a:gsub('%.exe$', '')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.set_title = function(process_name, static_title, active_title, max_width, inset)
|
||||||
|
local title
|
||||||
|
--
|
||||||
|
local icon
|
||||||
|
inset = inset or 6
|
||||||
|
|
||||||
|
if platform.is_win and not process_name:find('wsl') then
|
||||||
|
icon = ' '
|
||||||
|
elseif process_name:find('wsl') then
|
||||||
|
icon = ' '
|
||||||
|
elseif platform.is_mac then
|
||||||
|
icon = ' '
|
||||||
|
elseif platform.is_linux then
|
||||||
|
icon = ' '
|
||||||
|
end
|
||||||
|
|
||||||
|
title = icon .. process_name .. ' ~ ' .. ' '
|
||||||
|
if process_name:len() > 0 and static_title:len() == 0 then
|
||||||
|
title = icon .. process_name .. ' ~ ' .. ' '
|
||||||
|
elseif static_title:len() > 0 then
|
||||||
|
title = icon .. static_title .. ' ~ ' .. ' '
|
||||||
|
else
|
||||||
|
title = icon .. active_title .. ' ~ ' .. ' '
|
||||||
|
end
|
||||||
|
|
||||||
|
if title:len() > max_width - inset then
|
||||||
|
local diff = title:len() - max_width + inset
|
||||||
|
title = wezterm.truncate_right(title, title:len() - diff)
|
||||||
|
end
|
||||||
|
|
||||||
|
return title
|
||||||
|
end
|
||||||
|
|
||||||
|
M.check_if_admin = function(p)
|
||||||
|
if p:match('^Administrator: ') then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param fg string
|
||||||
|
---@param bg string
|
||||||
|
---@param attribute table
|
||||||
|
---@param text string
|
||||||
|
M.push = function(bg, fg, attribute, text)
|
||||||
|
table.insert(M.cells, { Background = { Color = bg } })
|
||||||
|
table.insert(M.cells, { Foreground = { Color = fg } })
|
||||||
|
table.insert(M.cells, { Attribute = attribute })
|
||||||
|
table.insert(M.cells, { Text = text })
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup = function()
|
||||||
|
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
|
||||||
|
M.cells = {}
|
||||||
|
|
||||||
|
local bg
|
||||||
|
local fg
|
||||||
|
local process_name = M.set_process_name(tab.active_pane.foreground_process_name)
|
||||||
|
local is_admin = M.check_if_admin(tab.active_pane.title)
|
||||||
|
local title = M.set_title(
|
||||||
|
process_name,
|
||||||
|
tab.tab_title,
|
||||||
|
tab.active_pane.title,
|
||||||
|
max_width,
|
||||||
|
(is_admin and 8)
|
||||||
|
)
|
||||||
|
|
||||||
|
if tab.is_active then
|
||||||
|
bg = M.colors.is_active.bg
|
||||||
|
fg = M.colors.is_active.fg
|
||||||
|
elseif hover then
|
||||||
|
bg = M.colors.hover.bg
|
||||||
|
fg = M.colors.hover.fg
|
||||||
|
else
|
||||||
|
bg = M.colors.default.bg
|
||||||
|
fg = M.colors.default.fg
|
||||||
|
end
|
||||||
|
|
||||||
|
local has_unseen_output = false
|
||||||
|
for _, pane in ipairs(tab.panes) do
|
||||||
|
if pane.has_unseen_output then
|
||||||
|
has_unseen_output = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Left semi-circle
|
||||||
|
M.push(fg, bg, { Intensity = 'Bold' }, GLYPH_SEMI_CIRCLE_LEFT)
|
||||||
|
|
||||||
|
-- Admin Icon
|
||||||
|
if is_admin then
|
||||||
|
M.push(bg, fg, { Intensity = 'Bold' }, ' ' .. GLYPH_ADMIN)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Title
|
||||||
|
M.push(bg, fg, { Intensity = 'Bold' }, ' ' .. title)
|
||||||
|
|
||||||
|
-- Unseen output alert
|
||||||
|
if has_unseen_output then
|
||||||
|
M.push(bg, '#79740e', { Intensity = 'Bold' }, ' ' .. GLYPH_CIRCLE)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Right padding
|
||||||
|
M.push(bg, fg, { Intensity = 'Bold' }, ' ')
|
||||||
|
|
||||||
|
-- Right semi-circle
|
||||||
|
M.push(fg, bg, { Intensity = 'Bold' }, GLYPH_SEMI_CIRCLE_RIGHT)
|
||||||
|
|
||||||
|
return M.cells
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
|
-- local CMD_ICON = utf8.char(0xe62a)
|
||||||
|
-- local NU_ICON = utf8.char(0xe7a8)
|
||||||
|
-- local PS_ICON = utf8.char(0xe70f)
|
||||||
|
-- local ELV_ICON = utf8.char(0xfc6f)
|
||||||
|
-- local WSL_ICON = utf8.char(0xf83c)
|
||||||
|
-- local YORI_ICON = utf8.char(0xf1d4)
|
||||||
|
-- local NYA_ICON = utf8.char(0xf61a)
|
||||||
|
--
|
||||||
|
-- local VIM_ICON = utf8.char(0xe62b)
|
||||||
|
-- local PAGER_ICON = utf8.char(0xf718)
|
||||||
|
-- local FUZZY_ICON = utf8.char(0xf0b0)
|
||||||
|
-- local HOURGLASS_ICON = utf8.char(0xf252)
|
||||||
|
-- local SUNGLASS_ICON = utf8.char(0xf9df)
|
||||||
|
--
|
||||||
|
-- local PYTHON_ICON = utf8.char(0xf820)
|
||||||
|
-- local NODE_ICON = utf8.char(0xe74e)
|
||||||
|
-- local DENO_ICON = utf8.char(0xe628)
|
||||||
|
-- local LAMBDA_ICON = utf8.char(0xfb26)
|
||||||
|
--
|
||||||
|
-- local SOLID_LEFT_ARROW = utf8.char(0xe0ba)
|
||||||
|
-- local SOLID_LEFT_MOST = utf8.char(0x2588)
|
||||||
|
-- local SOLID_RIGHT_ARROW = utf8.char(0xe0bc)
|
||||||
|
-- local ADMIN_ICON = utf8.char(0xf49c)
|
||||||
14
wezterm/.config/wezterm/utils/math.lua
Normal file
14
wezterm/.config/wezterm/utils/math.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
local _math = math
|
||||||
|
|
||||||
|
_math.clamp = function(x, min, max)
|
||||||
|
return x < min and min or (x > max and max or x)
|
||||||
|
end
|
||||||
|
|
||||||
|
_math.round = function(x, increment)
|
||||||
|
if increment then
|
||||||
|
return _math.round(x / increment) * increment
|
||||||
|
end
|
||||||
|
return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
return _math
|
||||||
15
wezterm/.config/wezterm/utils/platform.lua
Normal file
15
wezterm/.config/wezterm/utils/platform.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
local wezterm = require('wezterm')
|
||||||
|
|
||||||
|
local function is_found(str, pattern)
|
||||||
|
return string.find(str, pattern) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local function platform()
|
||||||
|
return {
|
||||||
|
is_win = is_found(wezterm.target_triple, 'windows'),
|
||||||
|
is_linux = is_found(wezterm.target_triple, 'linux'),
|
||||||
|
is_mac = is_found(wezterm.target_triple, 'apple'),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return platform
|
||||||
13
wezterm/.config/wezterm/wezterm.lua
Normal file
13
wezterm/.config/wezterm/wezterm.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
local Config = require('config')
|
||||||
|
|
||||||
|
require('events.right-status').setup()
|
||||||
|
require('events.tab-title').setup()
|
||||||
|
require('events.new-tab-button').setup()
|
||||||
|
|
||||||
|
return Config:init()
|
||||||
|
:append(require('config.appearance'))
|
||||||
|
:append(require('config.bindings'))
|
||||||
|
:append(require('config.domains'))
|
||||||
|
:append(require('config.fonts'))
|
||||||
|
:append(require('config.general'))
|
||||||
|
:append(require('config.launch')).options
|
||||||
Reference in New Issue
Block a user