wezterm: update config

This commit is contained in:
Gabriel Arazas 2025-01-29 12:38:17 +08:00
parent 5bff5dfdab
commit dab0e3aba6
4 changed files with 37 additions and 7 deletions

View File

@ -3,6 +3,8 @@ local module = {}
local wezterm = require("wezterm") local wezterm = require("wezterm")
-- This has to be setup outside of this configuration. I don't want to have the
-- same code fetching the colors all over various config files.
local xdg_data_home = os.getenv("XDG_DATA_HOME") or "~/.local/share" local xdg_data_home = os.getenv("XDG_DATA_HOME") or "~/.local/share"
local theme_dir = xdg_data_home .. "/base16/bark-on-a-tree" local theme_dir = xdg_data_home .. "/base16/bark-on-a-tree"
local light_scheme, light_scheme_metadata = local light_scheme, light_scheme_metadata =
@ -61,9 +63,8 @@ function module.apply_to_config(config)
-- Disable some more annoyances. -- Disable some more annoyances.
config.enable_tab_bar = true config.enable_tab_bar = true
config.enable_scroll_bar = false
config.tab_bar_at_bottom = false config.tab_bar_at_bottom = false
config.window_decorations = "RESIZE" config.window_decorations = "NONE"
-- Configuring the appearance of the tab bar. -- Configuring the appearance of the tab bar.
config.window_frame = { config.window_frame = {
@ -74,7 +75,7 @@ function module.apply_to_config(config)
-- Configuring the windows padding. -- Configuring the windows padding.
config.window_padding = { config.window_padding = {
left = 0, left = 0,
right = 0, right = '1cell',
top = 0, top = 0,
bottom = 0, bottom = 0,
} }

View File

@ -0,0 +1,13 @@
local module = {}
function module.get_zone_around_cursor(pane)
local cursor = pane:get_cursor_position()
-- using x-1 here because the cursor may be one cell outside the zone
local zone = pane:get_semantic_zone_at(cursor.x - 1, cursor.y)
if zone then
return pane:get_text_from_semantic_zone(zone)
end
return nil
end
return module

View File

@ -6,6 +6,19 @@ local keymod = base.keymod
local alt_keymod = base.alt_keymod local alt_keymod = base.alt_keymod
local module = {} local module = {}
local copy_mode = nil
if wezterm.gui then
copy_mode = wezterm.gui.default_key_tables().copy_mode
table.insert(
copy_mode,
{
key = 'z',
mods = keymod,
action = act.CopyMode { MoveBackwardZoneOfType = 'Output' },
}
)
end
function module.apply_to_config(config) function module.apply_to_config(config)
-- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition. -- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition.
config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 } config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 }
@ -100,7 +113,7 @@ function module.apply_to_config(config)
{ mods = alt_keymod, key = "j", action = act.ActivateTab(-1) }, { mods = alt_keymod, key = "j", action = act.ActivateTab(-1) },
{ mods = alt_keymod, key = "k", action = act.ActivateTab(0) }, { mods = alt_keymod, key = "k", action = act.ActivateTab(0) },
{ mods = alt_keymod, key = "l", action = act.ActivateTabRelative(1) }, { mods = alt_keymod, key = "l", action = act.ActivateTabRelative(1) },
{ key = "t", mods = keymod, action = act.ShowTabNavigator }, { key = "t", mods = alt_keymod, action = act.ShowTabNavigator },
{ key = "d", mods = alt_keymod, action = act.CloseCurrentTab({ confirm = false }) }, { key = "d", mods = alt_keymod, action = act.CloseCurrentTab({ confirm = false }) },
-- Hints and quick selections -- Hints and quick selections
@ -123,6 +136,7 @@ function module.apply_to_config(config)
{ key = "r", mods = keymod, action = act.ReloadConfiguration }, { key = "r", mods = keymod, action = act.ReloadConfiguration },
{ key = "o", mods = keymod, action = act.ShowDebugOverlay }, { key = "o", mods = keymod, action = act.ShowDebugOverlay },
{ key = "p", mods = keymod, action = act.ActivateCommandPalette }, { key = "p", mods = keymod, action = act.ActivateCommandPalette },
{ key = "y", mods = keymod, action = act.ActivateCopyMode },
{ key = "e", mods = keymod, action = act.EmitEvent("view-last-output-in-new-pane") }, { key = "e", mods = keymod, action = act.EmitEvent("view-last-output-in-new-pane") },
-- Selection -- Selection
@ -198,6 +212,8 @@ function module.apply_to_config(config)
{ key = "Escape", action = act.PopKeyTable }, { key = "Escape", action = act.PopKeyTable },
{ key = "Enter", action = act.PopKeyTable }, { key = "Enter", action = act.PopKeyTable },
}, },
copy_mode = copy_mode,
} }
return config return config
end end

View File

@ -8,9 +8,9 @@ function module.apply_to_config(config)
config.tls_clients = { config.tls_clients = {
{ {
name = "mux.foodogsquared.one", name = "foodogsquared.one",
remote_address = "mux.foodogsquared.one:9801", remote_address = "plover.foodogsquared.one:9801",
bootstrap_via_ssh = "plover@mux.foodogsquared.one", bootstrap_via_ssh = "plover@plover.foodogsquared.one",
}, },
} }