fix(wezterm): format lua code

This commit is contained in:
2025-05-05 16:35:07 +02:00
parent 3c56f15af6
commit 1551f4750c
6 changed files with 192 additions and 111 deletions
+120 -45
View File
@@ -1,59 +1,59 @@
local wezterm = require 'wezterm'
local wezterm = require("wezterm")
local act = wezterm.action
local M = {}
M.keys = {
{ key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen },
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo("Clipboard") },
{ key = 'V', mods = 'SHIFT|CTRL', action = act.PasteFrom("Clipboard") },
{ key = 'P', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'F12', mods = 'NONE', action = act.ShowDebugOverlay },
{ key = "Enter", mods = "ALT", action = act.ToggleFullScreen },
{ key = "=", mods = "CTRL", action = act.IncreaseFontSize },
{ key = "-", mods = "CTRL", action = act.DecreaseFontSize },
{ key = "0", mods = "CTRL", action = act.ResetFontSize },
{ key = "C", mods = "SHIFT|CTRL", action = act.CopyTo("Clipboard") },
{ key = "V", mods = "SHIFT|CTRL", action = act.PasteFrom("Clipboard") },
{ key = "P", mods = "SHIFT|CTRL", action = act.ActivateCommandPalette },
{ key = "R", mods = "SHIFT|CTRL", action = act.ReloadConfiguration },
{ key = "F12", mods = "NONE", action = act.ShowDebugOverlay },
}
M.mouse_bindings = {
-- Open links
{
event = { Up = { streak = 1, button = 'Left' } },
mods = 'CTRL',
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.OpenLinkAtMouseCursor,
},
-- Select text
{
event = { Down = { streak = 1, button = 'Left' } },
mods = 'CTRL',
event = { Down = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.SelectTextAtMouseCursor("Cell"),
},
{
event = { Drag = { streak = 1, button = 'Left' } },
mods = 'CTRL',
event = { Drag = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.ExtendSelectionToMouseCursor("Cell"),
},
{
event = { Down = { streak = 1, button = 'Left' } },
mods = 'CTRL|SHIFT',
event = { Down = { streak = 1, button = "Left" } },
mods = "CTRL|SHIFT",
action = act.ExtendSelectionToMouseCursor("Cell"),
},
-- Select text in block mode
{
event = { Down = { streak = 1, button = 'Left' } },
mods = 'CTRL|ALT',
event = { Down = { streak = 1, button = "Left" } },
mods = "CTRL|ALT",
action = act.SelectTextAtMouseCursor("Block"),
},
{
event = { Drag = { streak = 1, button = 'Left' } },
mods = 'CTRL|ALT',
event = { Drag = { streak = 1, button = "Left" } },
mods = "CTRL|ALT",
action = act.ExtendSelectionToMouseCursor("Block"),
},
{
event = { Down = { streak = 1, button = 'Left' } },
mods = 'CTRL|ALT|SHIFT',
event = { Down = { streak = 1, button = "Left" } },
mods = "CTRL|ALT|SHIFT",
action = act.ExtendSelectionToMouseCursor("Block"),
},
}
@@ -70,42 +70,117 @@ M.key_tables = wezterm.gui.default_key_tables()
-- })
function M.enable_multiplexing()
table.insert(M.keys, { key = "c", mods = "LEADER", action = act.SpawnTab("CurrentPaneDomain") })
table.insert(M.keys, { key = '%', mods = "LEADER|SHIFT", action = act.SplitPane({ direction = "Down" }) })
table.insert(M.keys, { key = '"', mods = "LEADER|SHIFT", action = act.SplitPane({ direction = "Right" }) })
table.insert(M.keys, { key = "x", mods = "LEADER", action = act.CloseCurrentPane({ confirm = true }) })
table.insert(M.keys, { key = "n", mods = "LEADER", action = act.ActivateTabRelative(1) })
table.insert(M.keys, { key = "p", mods = "LEADER", action = act.ActivateTabRelative(-1) })
table.insert(M.keys, { key = "h", mods = "LEADER", action = act.ActivatePaneDirection('Left') })
table.insert(M.keys, { key = "l", mods = "LEADER", action = act.ActivatePaneDirection('Right') })
table.insert(M.keys, { key = "k", mods = "LEADER", action = act.ActivatePaneDirection('Up') })
table.insert(M.keys, { key = "j", mods = "LEADER", action = act.ActivatePaneDirection('Down') })
table.insert(M.keys, { key = "[", mods = "LEADER", action = act.ActivateCopyMode })
table.insert(M.keys, { key = '?', mods = 'LEADER|SHIFT', action = act.Search("CurrentSelectionOrEmptyString") })
table.insert(
M.keys,
{
key = "c",
mods = "LEADER",
action = act.SpawnTab("CurrentPaneDomain"),
}
)
table.insert(
M.keys,
{
key = "%",
mods = "LEADER|SHIFT",
action = act.SplitPane({ direction = "Down" }),
}
)
table.insert(
M.keys,
{
key = '"',
mods = "LEADER|SHIFT",
action = act.SplitPane({ direction = "Right" }),
}
)
table.insert(
M.keys,
{
key = "x",
mods = "LEADER",
action = act.CloseCurrentPane({ confirm = true }),
}
)
table.insert(
M.keys,
{ key = "n", mods = "LEADER", action = act.ActivateTabRelative(1) }
)
table.insert(
M.keys,
{ key = "p", mods = "LEADER", action = act.ActivateTabRelative(-1) }
)
table.insert(
M.keys,
{
key = "h",
mods = "LEADER",
action = act.ActivatePaneDirection("Left"),
}
)
table.insert(
M.keys,
{
key = "l",
mods = "LEADER",
action = act.ActivatePaneDirection("Right"),
}
)
table.insert(
M.keys,
{ key = "k", mods = "LEADER", action = act.ActivatePaneDirection("Up") }
)
table.insert(
M.keys,
{
key = "j",
mods = "LEADER",
action = act.ActivatePaneDirection("Down"),
}
)
table.insert(
M.keys,
{ key = "[", mods = "LEADER", action = act.ActivateCopyMode }
)
table.insert(
M.keys,
{
key = "?",
mods = "LEADER|SHIFT",
action = act.Search("CurrentSelectionOrEmptyString"),
}
)
for i = 1, 9 do
table.insert(M.keys, { key = tostring(i), mods = "LEADER", action = act.ActivateTab(i - 1) })
table.insert(
M.keys,
{
key = tostring(i),
mods = "LEADER",
action = act.ActivateTab(i - 1),
}
)
end
table.insert(M.mouse_bindings, {
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = 'NONE',
action = act.ScrollByLine(-3)
mods = "NONE",
action = act.ScrollByLine(-3),
})
table.insert(M.mouse_bindings, {
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = 'NONE',
action = act.ScrollByLine(3)
mods = "NONE",
action = act.ScrollByLine(3),
})
table.insert(M.mouse_bindings, {
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = 'ALT',
action = act.ScrollByPage(-1)
mods = "ALT",
action = act.ScrollByPage(-1),
})
table.insert(M.mouse_bindings, {
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = 'ALT',
action = act.ScrollByPage(1)
mods = "ALT",
action = act.ScrollByPage(1),
})
end
+37 -38
View File
@@ -1,73 +1,72 @@
local my_colors = {
foreground = '#b2b2b2',
background = '#000000',
cursor_fg = '#000000',
cursor_bg = '#b2b2b2',
cursor_border = '#b2b2b2',
selection_fg = '#000000',
selection_bg = '#b2b2b2',
scrollbar_thumb = '#000000',
split = '#000000',
foreground = "#b2b2b2",
background = "#000000",
cursor_fg = "#000000",
cursor_bg = "#b2b2b2",
cursor_border = "#b2b2b2",
selection_fg = "#000000",
selection_bg = "#b2b2b2",
scrollbar_thumb = "#000000",
split = "#000000",
ansi = {
'#2e3436', -- black
'#cc5555', -- red
'#4e9a06', -- green
'#c4a000', -- yellow
'#6465a4', -- blue
'#75507b', -- magenta
'#06989a', -- cyan
'#b2b2b2', -- white
"#2e3436", -- black
"#cc5555", -- red
"#4e9a06", -- green
"#c4a000", -- yellow
"#6465a4", -- blue
"#75507b", -- magenta
"#06989a", -- cyan
"#b2b2b2", -- white
},
brights = {
'#555753', -- black
'#ff5555', -- red
'#8ae234', -- green
'#fce94f', -- yellow
'#739fcf', -- blue
'#ad7fa8', -- magenta
'#34e2e2', -- cyan
'#d3d7cf', -- white
"#555753", -- black
"#ff5555", -- red
"#8ae234", -- green
"#fce94f", -- yellow
"#739fcf", -- blue
"#ad7fa8", -- magenta
"#34e2e2", -- cyan
"#d3d7cf", -- white
},
compose_cursor = 'orange',
compose_cursor = "orange",
tab_bar = {
-- The color of the strip that goes along the top of the window
-- (does not apply when fancy tab bar is in use)
background = '#000000',
background = "#000000",
-- The active tab is the one that has focus in the window
active_tab = {
-- The color of the background area for the tab
bg_color = '#000000',
bg_color = "#000000",
-- The color of the text for the tab
fg_color = '#c0c0c0',
fg_color = "#c0c0c0",
},
-- Inactive tabs are the tabs that do not have focus
inactive_tab = {
bg_color = '#000000',
fg_color = '#808080',
bg_color = "#000000",
fg_color = "#808080",
},
-- You can configure some alternate styling when the mouse pointer
-- moves over inactive tabs
inactive_tab_hover = {
bg_color = '#000000',
fg_color = '#c0c0c0',
bg_color = "#000000",
fg_color = "#c0c0c0",
-- The same options that were listed under the `active_tab` section above
-- can also be used for `inactive_tab_hover`.
},
-- The new tab button that let you create new tabs
new_tab = {
bg_color = '#000000',
fg_color = '#808080',
bg_color = "#000000",
fg_color = "#808080",
},
new_tab_hover = {
bg_color = '#000000',
fg_color = '#c0c0c0',
bg_color = "#000000",
fg_color = "#c0c0c0",
},
},
}
+17 -18
View File
@@ -3,25 +3,24 @@ local wezterm = require("wezterm")
local M = {}
function M.setup()
wezterm.on('format-window-title', function() return "WezTerm" end)
wezterm.on(
'format-tab-title',
function(tab, _, _, _, _, _)
local title = tab.tab_title
if not title or #title <= 0 then
title = tab.active_pane.title
end
title = " " .. tab.tab_index + 1 .. ": " .. title
if tab.is_active then
title = title .. "*"
else
title = title .. " "
end
return {
{ Text = title },
}
wezterm.on("format-window-title", function()
return "WezTerm"
end)
wezterm.on("format-tab-title", function(tab, _, _, _, _, _)
local title = tab.tab_title
if not title or #title <= 0 then
title = tab.active_pane.title
end
)
title = " " .. tab.tab_index + 1 .. ": " .. title
if tab.is_active then
title = title .. "*"
else
title = title .. " "
end
return {
{ Text = title },
}
end)
end
return M
+7 -8
View File
@@ -10,44 +10,43 @@ fonts.regular = wezterm.font({
family = family,
weight = "Regular",
stretch = "Normal",
style = "Normal"
style = "Normal",
})
fonts.italic = wezterm.font({
family = family,
weight = "Regular",
stretch = "Normal",
style = "Italic"
style = "Italic",
})
fonts.bold = wezterm.font({
family = family,
weight = "Bold",
stretch = "Normal",
style = "Normal"
style = "Normal",
})
fonts.bolditalic = wezterm.font({
family = family,
weight = "Bold",
stretch = "Normal",
style = "Italic"
style = "Italic",
})
fonts.rules = {
italic = {
intensity = "Normal",
italic = true,
font = fonts.italic
font = fonts.italic,
},
bold = {
intensity = "Bold",
italic = false,
font = fonts.bold
font = fonts.bold,
},
bolditalic = {
intensity = "Bold",
italic = true,
font = fonts.bolditalic
font = fonts.bolditalic,
},
}
return fonts
+1 -2
View File
@@ -32,7 +32,6 @@ else
config.default_prog = { "zsh" }
end
-- Colors
config.color_scheme = "moonfly"
@@ -48,7 +47,7 @@ config.font_rules = {
fonts.rules.bold,
fonts.rules.bolditalic,
}
config.harfbuzz_features = { 'calt=0' }
config.harfbuzz_features = { "calt=0" }
-- Keybinding