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