diff options
| author | Ibrahim Muftee <ibrahim@muftee.net> | 2024-10-03 17:41:43 -0500 |
|---|---|---|
| committer | Ibrahim Muftee <ibrahim@muftee.net> | 2026-07-01 00:23:31 -0400 |
| commit | be938fafe4a09ea4f74f6cb3efb5c4046ede30bc (patch) | |
| tree | fc316b55ddf7271373c9a63ce01c67f2f1fb0dd9 /dot_config/wezterm/keys.lua | |
| parent | 43d6f16f3111fd2a76db0a2f70c4b5527ce874af (diff) | |
feat(wezterm): add keybindings for tabs and panes
Diffstat (limited to 'dot_config/wezterm/keys.lua')
| -rw-r--r-- | dot_config/wezterm/keys.lua | 70 |
1 files changed, 46 insertions, 24 deletions
diff --git a/dot_config/wezterm/keys.lua b/dot_config/wezterm/keys.lua index 22889da..724840f 100644 --- a/dot_config/wezterm/keys.lua +++ b/dot_config/wezterm/keys.lua @@ -1,36 +1,58 @@ local wezterm = require("wezterm") local M = { - leader = { key = "t", mods = "CTRL", timeout_milliseconds = 500 }, - key_bindings = { - -- Leader commands - -- Ctrl+t (for "terminal" is my leader key for Wezterm, and it's the gateway - -- into all my most-used terminal commands. - -- By avoiding the single keystroke Ctrl+t in my Vim config, I can prevent - -- key conflicts between Vim and Wezterm. + leader = { key = "t", mods = "CTRL", timeout_milliseconds = 500 }, + key_bindings = { + -- Leader commands + -- Ctrl+t (for "terminal" is my leader key for Wezterm, and it's the gateway + -- into all my most-used terminal commands. + -- By avoiding the single keystroke Ctrl+t in my Vim config, I can prevent + -- key conflicts between Vim and Wezterm. - -- Pane splitting - { key = "s", mods = "LEADER|CTRL", action = wezterm.action.SplitHorizontal }, - { key = "v", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.SplitVertical }, + -- Window controls + { key = "n", mods = "LEADER", action = wezterm.action.SpawnWindow }, - -- Clipboard actions - { key = "v", mods = "LEADER|CTRL", action = wezterm.action.PasteFrom("Clipboard") }, - { key = "x", mods = "LEADER|CTRL", action = wezterm.action.ActivateCopyMode }, + -- Tab controls + { key = "t", mods = "LEADER|CTRL", action = wezterm.action.SpawnTab("CurrentPaneDomain") }, - -- Fallback - use Ctrl-T, Ctrl-Shift-T to send a literal "Ctrl-T" to the console - { key = "t", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.SendKey({ key = "t", mods = "CTRL" }) }, + { key = "1", mods = "LEADER", action = wezterm.action.ActivateTab(0) }, + { key = "2", mods = "LEADER", action = wezterm.action.ActivateTab(1) }, + { key = "3", mods = "LEADER", action = wezterm.action.ActivateTab(2) }, + { key = "4", mods = "LEADER", action = wezterm.action.ActivateTab(3) }, + { key = "5", mods = "LEADER", action = wezterm.action.ActivateTab(4) }, + { key = "6", mods = "LEADER", action = wezterm.action.ActivateTab(5) }, - -- Ctrl+h/j/k/l is for Vim, so use C+A+h/j/k/l to move between - -- panes in the terminal - { key = "h", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Left" } }, - { key = "j", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Down" } }, - { key = "k", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Up" } }, - { key = "l", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Right" } }, + { key = "l", mods = "LEADER", action = wezterm.action.ActivateTabRelative(1) }, + { key = "h", mods = "LEADER", action = wezterm.action.ActivateTabRelative(-1) }, - -- Reload config - { key = "r", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.ReloadConfiguration }, + { key = "w", mods = "LEADER", action = wezterm.action.CloseCurrentTab({ confirm = true }) }, - }, + -- Pane controls + { key = "s", mods = "LEADER", action = wezterm.action.SplitHorizontal }, + { key = "v", mods = "LEADER", action = wezterm.action.SplitVertical }, + { key = "c", mods = "LEADER", action = wezterm.action.CloseCurrentPane({ confirm = false }) }, + + -- Clipboard actions + { key = "v", mods = "LEADER|CTRL", action = wezterm.action.PasteFrom("Clipboard") }, + { key = "x", mods = "LEADER|CTRL", action = wezterm.action.ActivateCopyMode }, + + -- Fallback - use Ctrl-T, Ctrl-Shift-T to send a literal "Ctrl-T" to the console + { key = "t", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.SendKey({ key = "t", mods = "CTRL" }) }, + + -- Ctrl+h/j/k/l is for Vim, so use C+A+h/j/k/l to move between + -- panes in the terminal + { key = "h", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Left" } }, + { key = "j", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Down" } }, + { key = "k", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Up" } }, + { key = "l", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Right" } }, + + -- Reload config + { key = "r", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.ReloadConfiguration }, + + -- Move the config overlay to different keymap (Ctrl-Shift-L used by Tmux) + { key = "L", mods = "CTRL", action = wezterm.action.DisableDefaultAssignment }, + { key = "l", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.ShowDebugOverlay }, + }, } return M |
