|
|
@ -1,6 +1,7 @@
|
|
|
|
local wezterm = require("wezterm")
|
|
|
|
local wezterm = require("wezterm")
|
|
|
|
local act = wezterm.action
|
|
|
|
local act = wezterm.action
|
|
|
|
local wsl_domains = wezterm.default_wsl_domains()
|
|
|
|
local wsl_domains = wezterm.default_wsl_domains()
|
|
|
|
|
|
|
|
local c = wezterm.config_builder()
|
|
|
|
|
|
|
|
|
|
|
|
-- WSL related
|
|
|
|
-- WSL related
|
|
|
|
for _, dom in ipairs(wsl_domains) do
|
|
|
|
for _, dom in ipairs(wsl_domains) do
|
|
|
@ -23,191 +24,65 @@ if get_os() == "windows" then
|
|
|
|
default_domain = "WSL:Ubuntu-20.04"
|
|
|
|
default_domain = "WSL:Ubuntu-20.04"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Superscript/Subscript
|
|
|
|
c.set_environment_variables = {
|
|
|
|
local function numberStyle(number, script)
|
|
|
|
ZVM_TERM = "xterm-256color",
|
|
|
|
local scripts = {
|
|
|
|
}
|
|
|
|
superscript = {
|
|
|
|
|
|
|
|
"⁰",
|
|
|
|
|
|
|
|
"¹",
|
|
|
|
|
|
|
|
"²",
|
|
|
|
|
|
|
|
"³",
|
|
|
|
|
|
|
|
"⁴",
|
|
|
|
|
|
|
|
"⁵",
|
|
|
|
|
|
|
|
"⁶",
|
|
|
|
|
|
|
|
"⁷",
|
|
|
|
|
|
|
|
"⁸",
|
|
|
|
|
|
|
|
"⁹",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
subscript = {
|
|
|
|
|
|
|
|
"₀",
|
|
|
|
|
|
|
|
"₁",
|
|
|
|
|
|
|
|
"₂",
|
|
|
|
|
|
|
|
"₃",
|
|
|
|
|
|
|
|
"₄",
|
|
|
|
|
|
|
|
"₅",
|
|
|
|
|
|
|
|
"₆",
|
|
|
|
|
|
|
|
"₇",
|
|
|
|
|
|
|
|
"₈",
|
|
|
|
|
|
|
|
"₉",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
local numbers = scripts[script]
|
|
|
|
|
|
|
|
local number_string = tostring(number)
|
|
|
|
|
|
|
|
local result = ""
|
|
|
|
|
|
|
|
for i = 1, #number_string do
|
|
|
|
|
|
|
|
local char = number_string:sub(i, i)
|
|
|
|
|
|
|
|
local num = tonumber(char)
|
|
|
|
|
|
|
|
if num then
|
|
|
|
|
|
|
|
result = result .. numbers[num + 1]
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
result = result .. char
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Custom Tab Bar
|
|
|
|
|
|
|
|
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
|
|
|
|
|
|
|
|
local RIGHT_DIVIDER = utf8.char(0xe0bc)
|
|
|
|
|
|
|
|
local colours = config.resolved_palette.tab_bar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local active_tab_index = 0
|
|
|
|
|
|
|
|
for _, t in ipairs(tabs) do
|
|
|
|
|
|
|
|
if t.is_active == true then
|
|
|
|
|
|
|
|
active_tab_index = t.tab_index
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local active_bg = colours.active_tab.bg_color
|
|
|
|
|
|
|
|
local active_fg = colours.active_tab.fg_color
|
|
|
|
|
|
|
|
local inactive_bg = colours.inactive_tab.bg_color
|
|
|
|
|
|
|
|
local inactive_fg = colours.inactive_tab.fg_color
|
|
|
|
|
|
|
|
local new_tab_bg = colours.new_tab.bg_color
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local s_bg, s_fg, e_bg, e_fg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- the last tab
|
|
|
|
|
|
|
|
if tab.tab_index == #tabs - 1 then
|
|
|
|
|
|
|
|
if tab.is_active then
|
|
|
|
|
|
|
|
s_bg = active_bg
|
|
|
|
|
|
|
|
s_fg = active_fg
|
|
|
|
|
|
|
|
e_bg = new_tab_bg
|
|
|
|
|
|
|
|
e_fg = active_bg
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
s_bg = inactive_bg
|
|
|
|
|
|
|
|
s_fg = inactive_fg
|
|
|
|
|
|
|
|
e_bg = new_tab_bg
|
|
|
|
|
|
|
|
e_fg = inactive_bg
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
elseif tab.tab_index == active_tab_index - 1 then
|
|
|
|
|
|
|
|
s_bg = inactive_bg
|
|
|
|
|
|
|
|
s_fg = inactive_fg
|
|
|
|
|
|
|
|
e_bg = active_bg
|
|
|
|
|
|
|
|
e_fg = inactive_bg
|
|
|
|
|
|
|
|
elseif tab.is_active then
|
|
|
|
|
|
|
|
s_bg = active_bg
|
|
|
|
|
|
|
|
s_fg = active_fg
|
|
|
|
|
|
|
|
e_bg = inactive_bg
|
|
|
|
|
|
|
|
e_fg = active_bg
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
s_bg = inactive_bg
|
|
|
|
|
|
|
|
s_fg = inactive_fg
|
|
|
|
|
|
|
|
e_bg = inactive_bg
|
|
|
|
|
|
|
|
e_fg = inactive_bg
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local muxpanes = wezterm.mux.get_tab(tab.tab_id):panes()
|
|
|
|
|
|
|
|
local count = #muxpanes == 1 and "" or #muxpanes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
{ Background = { Color = s_bg } },
|
|
|
|
|
|
|
|
{ Foreground = { Color = s_fg } },
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Text = " " .. tab.tab_index + 1 .. ": " .. tab.active_pane.title .. numberStyle(count, "superscript") .. " ",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ Background = { Color = e_bg } },
|
|
|
|
|
|
|
|
{ Foreground = { Color = e_fg } },
|
|
|
|
|
|
|
|
{ Text = RIGHT_DIVIDER },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
c.term = "wezterm"
|
|
|
|
set_environment_variables = {
|
|
|
|
c.font = wezterm.font_with_fallback({ "VictorMono Nerd Font" })
|
|
|
|
ZVM_TERM = "xterm-256color"
|
|
|
|
c.font_size = 13
|
|
|
|
},
|
|
|
|
c.background = {
|
|
|
|
term = "wezterm",
|
|
|
|
|
|
|
|
color_scheme = "Catppuccin Mocha",
|
|
|
|
|
|
|
|
font = wezterm.font_with_fallback({ "VictorMono Nerd Font" }),
|
|
|
|
|
|
|
|
font_size = 13,
|
|
|
|
|
|
|
|
background = {
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
source = { File = "Pictures/astronaut.png" },
|
|
|
|
source = { File = "Pictures/astronaut.png" },
|
|
|
|
hsb = { brightness = 0.07, hue = 1.0, saturation = 0.1 },
|
|
|
|
hsb = { brightness = 0.07, hue = 1.0, saturation = 0.1 },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default_domain = default_domain,
|
|
|
|
c.default_domain = default_domain
|
|
|
|
wsl_domains = wsl_domains,
|
|
|
|
c.wsl_domains = wsl_domains
|
|
|
|
default_prog = default_prog,
|
|
|
|
c.default_prog = default_prog
|
|
|
|
|
|
|
|
|
|
|
|
window_padding = { top = 0, bottom = 0, left = 0, right = 0 },
|
|
|
|
c.window_padding = { top = 0, bottom = 0, left = 0, right = 0 }
|
|
|
|
adjust_window_size_when_changing_font_size = false,
|
|
|
|
c.adjust_window_size_when_changing_font_size = false
|
|
|
|
window_decorations = "RESIZE",
|
|
|
|
c.window_decorations = "RESIZE"
|
|
|
|
window_close_confirmation = "NeverPrompt",
|
|
|
|
c.window_close_confirmation = "NeverPrompt"
|
|
|
|
|
|
|
|
|
|
|
|
use_fancy_tab_bar = false,
|
|
|
|
c.use_fancy_tab_bar = false
|
|
|
|
tab_bar_at_bottom = true,
|
|
|
|
c.tab_bar_at_bottom = true
|
|
|
|
hide_tab_bar_if_only_one_tab = true,
|
|
|
|
c.hide_tab_bar_if_only_one_tab = true
|
|
|
|
tab_max_width = 32,
|
|
|
|
c.tab_max_width = 32
|
|
|
|
scrollback_lines = 1000000,
|
|
|
|
c.scrollback_lines = 1000000
|
|
|
|
|
|
|
|
|
|
|
|
exit_behavior = "CloseOnCleanExit",
|
|
|
|
c.exit_behavior = "CloseOnCleanExit"
|
|
|
|
clean_exit_codes = { 130 },
|
|
|
|
c.clean_exit_codes = { 130 }
|
|
|
|
audible_bell = "Disabled",
|
|
|
|
c.audible_bell = "Disabled"
|
|
|
|
disable_default_key_bindings = false,
|
|
|
|
c.disable_default_key_bindings = false
|
|
|
|
|
|
|
|
|
|
|
|
keys = {
|
|
|
|
c.mouse_bindings = {
|
|
|
|
|
|
|
|
-- Ctrl-click will open the link under the mouse cursor
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
event = { Up = { streak = 1, button = "Left" } },
|
|
|
|
|
|
|
|
mods = "CTRL",
|
|
|
|
|
|
|
|
action = wezterm.action.OpenLinkAtMouseCursor,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
c.keys = {
|
|
|
|
-- Fullscreen
|
|
|
|
-- Fullscreen
|
|
|
|
{ key = "F11", action = wezterm.action.ToggleFullScreen },
|
|
|
|
{ key = "F11", action = wezterm.action.ToggleFullScreen },
|
|
|
|
-- Zoom
|
|
|
|
-- Zoom
|
|
|
|
{ key = "z", mods = "ALT|SHIFT", action = wezterm.action.TogglePaneZoomState },
|
|
|
|
{ key = "z", mods = "ALT|SHIFT", action = wezterm.action.TogglePaneZoomState },
|
|
|
|
-- Copy / Paste
|
|
|
|
-- Copy / Paste
|
|
|
|
{ key = "C", mods = "CTRL", action = wezterm.action.CopyTo("Clipboard") },
|
|
|
|
{ key = "c", mods = "ALT|SHIFT", action = wezterm.action.CopyTo("Clipboard") },
|
|
|
|
{ key = "V", mods = "CTRL", action = act.PasteFrom("Clipboard") },
|
|
|
|
{ key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("Clipboard") },
|
|
|
|
|
|
|
|
|
|
|
|
-- Open Pane
|
|
|
|
-- CMD Palette
|
|
|
|
-- https://github.com/wez/wezterm/discussions/2426
|
|
|
|
{ key = "p", mods = "ALT|SHIFT", action = act.ActivateCommandPalette },
|
|
|
|
-- https://github.com/neovim/neovim/issues/2252
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
key = "n",
|
|
|
|
|
|
|
|
mods = "ALT|SHIFT",
|
|
|
|
|
|
|
|
action = wezterm.action_callback(function(window, pane)
|
|
|
|
|
|
|
|
if pane:get_title() == "nvim" then
|
|
|
|
|
|
|
|
window:perform_action(act.SendKey({ key = "n", mods = "ALT|SHIFT" }), pane)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
window:perform_action(act.SplitPane({ direction = "Right", size = { Percent = 50 } }), pane)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
key = "m",
|
|
|
|
|
|
|
|
mods = "ALT|SHIFT",
|
|
|
|
|
|
|
|
action = wezterm.action_callback(function(window, pane)
|
|
|
|
|
|
|
|
if pane:get_title() == "nvim" then
|
|
|
|
|
|
|
|
window:perform_action(act.SendKey({ key = "m", mods = "ALT|SHIFT" }), pane)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
window:perform_action(act.SplitPane({ direction = "Down", size = { Percent = 50 } }), pane)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Navigating Panes
|
|
|
|
-- Navigating Panes
|
|
|
|
{ key = "h", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Left") },
|
|
|
|
{ key = "h", mods = "ALT|SHIFT", action = act.ActivateTabRelative(-1) },
|
|
|
|
{ key = "l", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Right") },
|
|
|
|
{ key = "l", mods = "ALT|SHIFT", action = act.ActivateTabRelative(1) },
|
|
|
|
{ key = "k", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Up") },
|
|
|
|
|
|
|
|
{ key = "j", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Down") },
|
|
|
|
|
|
|
|
-- Close Pane
|
|
|
|
-- Close Pane
|
|
|
|
{ key = "c", mods = "ALT|SHIFT", action = wezterm.action.CloseCurrentPane({ confirm = false }) },
|
|
|
|
{ key = "d", mods = "ALT|SHIFT", action = act.CloseCurrentTab({ confirm = false }) },
|
|
|
|
-- Swap Panes
|
|
|
|
-- Swap Panes
|
|
|
|
{ key = "i", mods = "ALT|SHIFT", action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "Activate" }) },
|
|
|
|
{ key = "i", mods = "ALT|SHIFT", action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "Activate" }) },
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -222,12 +97,9 @@ return {
|
|
|
|
{ key = "RightArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Right", 5 } }) },
|
|
|
|
{ key = "RightArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Right", 5 } }) },
|
|
|
|
|
|
|
|
|
|
|
|
-- New Tab
|
|
|
|
-- New Tab
|
|
|
|
{ key = "n", mods = "CTRL|SHIFT", action = act({ SpawnTab = "CurrentPaneDomain" }) },
|
|
|
|
{ key = "n", mods = "ALT|SHIFT", action = act({ SpawnTab = "CurrentPaneDomain" }) },
|
|
|
|
-- Swap Tabs
|
|
|
|
|
|
|
|
{ key = "h", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(-1) },
|
|
|
|
|
|
|
|
{ key = "l", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(1) },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Open Links
|
|
|
|
-- Open Links Via Keyboard
|
|
|
|
{
|
|
|
|
{
|
|
|
|
key = "o",
|
|
|
|
key = "o",
|
|
|
|
mods = "ALT|SHIFT",
|
|
|
|
mods = "ALT|SHIFT",
|
|
|
@ -246,5 +118,22 @@ return {
|
|
|
|
-- ScrollBack To Prompt
|
|
|
|
-- ScrollBack To Prompt
|
|
|
|
{ key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(-1) },
|
|
|
|
{ key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(-1) },
|
|
|
|
{ key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(1) },
|
|
|
|
{ key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(1) },
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wezterm.plugin.require("https://github.com/catppuccin/wezterm").apply_to_config(c, {
|
|
|
|
|
|
|
|
flavor = "mocha",
|
|
|
|
|
|
|
|
sync = wezterm.target_triple:find("darwin") ~= nil,
|
|
|
|
|
|
|
|
sync_flavors = { light = "latte", dark = "mocha" },
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
wezterm.plugin.require("https://github.com/nekowinston/wezterm-bar").apply_to_config(c, {
|
|
|
|
|
|
|
|
indicator = {
|
|
|
|
|
|
|
|
leader = { enabled = false },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wezterm.on("update-status", function(window, pane)
|
|
|
|
|
|
|
|
-- local colours = conf.resolved_palette.tab_bar
|
|
|
|
|
|
|
|
wezterm.log_info(window:effective_config())
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return c
|
|
|
|