---@module "mappings.default" ---@author sravioli ---@license GNU-GPLv3 ---@diagnostic disable-next-line: undefined-field local act = require("wezterm").action local key = require("utils.fn").key local Config = {} Config.disable_default_key_bindings = true Config.leader = { key = "Space", mods = "CTRL", timeout_milliseconds = 1000 } local mappings = { { "", act.ActivateTabRelative(1), "next tab" }, { "", act.ActivateTabRelative(-1), "prev tab" }, { "", act.ToggleFullScreen, "fullscreen" }, { "", act.CopyTo "Clipboard", "copy" }, { "", act.PasteFrom "Clipboard", "paste" }, { "", act.Search "CurrentSelectionOrEmptyString", "search" }, { "", act.ClearScrollback "ScrollbackOnly", "clear scrollback" }, { "", act.ShowDebugOverlay, "debug overlay" }, { "", act.SpawnWindow, "new window" }, { "", act.ActivateCommandPalette, "command palette" }, { "", act.ReloadConfiguration, "reload config" }, { "", act.SpawnTab "CurrentPaneDomain", "new pane" }, { "", act.CharSelect { copy_on_select = true, copy_to = "ClipboardAndPrimarySelection", }, "char select", }, { "", act.CloseCurrentTab { confirm = true }, "close tab" }, { "", act.TogglePaneZoomState, "toggle zoom" }, { "", act.ScrollByPage(-1), "" }, { "", act.ScrollByPage(1), "" }, { "", act.PasteFrom "PrimarySelection", "" }, { "", act.CopyTo "PrimarySelection", "" }, { "", act.QuickSelect, "quick select" }, { "", act.ShowLauncherArgs { title = " Search:", flags = "FUZZY|LAUNCH_MENU_ITEMS|DOMAINS", }, "new window", }, ---quick split and nav { '', act.SplitHorizontal { domain = "CurrentPaneDomain" }, "vsplit" }, { "", act.SplitVertical { domain = "CurrentPaneDomain" }, "hsplit" }, { "", act.ActivatePaneDirection "Left", "move left" }, { "", act.ActivatePaneDirection "Down", "mode down" }, { "", act.ActivatePaneDirection "Up", "move up" }, { "", act.ActivatePaneDirection "Right", "move right" }, ---key tables { "h", act.ActivateKeyTable { name = "help_mode", one_shot = true }, "help" }, { "w", act.ActivateKeyTable { name = "window_mode", one_shot = false }, "window mode", }, { "f", act.ActivateKeyTable { name = "font_mode", one_shot = false }, "font mode", }, { "c", act.ActivateCopyMode, "copy mode" }, { "s", act.Search "CurrentSelectionOrEmptyString", "search mode" }, { "p", act.ActivateKeyTable { name = "pick_mode" }, "pick mode" }, } for i = 1, 24 do mappings[#mappings + 1] = { "", act.ActivateTab(i - 1), "activate tab " .. i } end Config.keys = {} for _, map_tbl in ipairs(mappings) do key.map(map_tbl[1], map_tbl[2], Config.keys) end return Config