From dab0e3aba6dc90eb1cd28815f0c0921c702e13e0 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 29 Jan 2025 12:38:17 +0800 Subject: [PATCH] wezterm: update config --- wezterm/config/appearance.lua | 7 ++++--- wezterm/config/helpers.lua | 13 +++++++++++++ wezterm/config/keys.lua | 18 +++++++++++++++++- wezterm/config/mux_server.lua | 6 +++--- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 wezterm/config/helpers.lua diff --git a/wezterm/config/appearance.lua b/wezterm/config/appearance.lua index 9d7ce59..26e8831 100644 --- a/wezterm/config/appearance.lua +++ b/wezterm/config/appearance.lua @@ -3,6 +3,8 @@ local module = {} 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 theme_dir = xdg_data_home .. "/base16/bark-on-a-tree" local light_scheme, light_scheme_metadata = @@ -61,9 +63,8 @@ function module.apply_to_config(config) -- Disable some more annoyances. config.enable_tab_bar = true - config.enable_scroll_bar = false config.tab_bar_at_bottom = false - config.window_decorations = "RESIZE" + config.window_decorations = "NONE" -- Configuring the appearance of the tab bar. config.window_frame = { @@ -74,7 +75,7 @@ function module.apply_to_config(config) -- Configuring the windows padding. config.window_padding = { left = 0, - right = 0, + right = '1cell', top = 0, bottom = 0, } diff --git a/wezterm/config/helpers.lua b/wezterm/config/helpers.lua new file mode 100644 index 0000000..951fd66 --- /dev/null +++ b/wezterm/config/helpers.lua @@ -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 diff --git a/wezterm/config/keys.lua b/wezterm/config/keys.lua index 8c650ee..9c7c067 100644 --- a/wezterm/config/keys.lua +++ b/wezterm/config/keys.lua @@ -6,6 +6,19 @@ local keymod = base.keymod local alt_keymod = base.alt_keymod 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) -- I'm very used to setting as the leader so I'm continuing the tradition. 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 = "k", action = act.ActivateTab(0) }, { 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 }) }, -- Hints and quick selections @@ -123,6 +136,7 @@ function module.apply_to_config(config) { key = "r", mods = keymod, action = act.ReloadConfiguration }, { key = "o", mods = keymod, action = act.ShowDebugOverlay }, { 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") }, -- Selection @@ -198,6 +212,8 @@ function module.apply_to_config(config) { key = "Escape", action = act.PopKeyTable }, { key = "Enter", action = act.PopKeyTable }, }, + + copy_mode = copy_mode, } return config end diff --git a/wezterm/config/mux_server.lua b/wezterm/config/mux_server.lua index dc029b0..ecdaf5b 100644 --- a/wezterm/config/mux_server.lua +++ b/wezterm/config/mux_server.lua @@ -8,9 +8,9 @@ function module.apply_to_config(config) config.tls_clients = { { - name = "mux.foodogsquared.one", - remote_address = "mux.foodogsquared.one:9801", - bootstrap_via_ssh = "plover@mux.foodogsquared.one", + name = "foodogsquared.one", + remote_address = "plover.foodogsquared.one:9801", + bootstrap_via_ssh = "plover@plover.foodogsquared.one", }, }