From 0841698bd400a67baac7cf358c851e67d23a4b12 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Sat, 18 Nov 2023 07:53:20 -0700 Subject: [PATCH] Add wezterm key mappings. --- jrpotter/default.nix | 1 + jrpotter/wezterm/default.nix | 4 ++ jrpotter/wezterm/wezterm.lua | 111 +++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 jrpotter/wezterm/default.nix create mode 100644 jrpotter/wezterm/wezterm.lua diff --git a/jrpotter/default.nix b/jrpotter/default.nix index ff645df..47b6631 100644 --- a/jrpotter/default.nix +++ b/jrpotter/default.nix @@ -3,6 +3,7 @@ imports = [ ./git.nix ./neovim + ./wezterm ]; home = { diff --git a/jrpotter/wezterm/default.nix b/jrpotter/wezterm/default.nix new file mode 100644 index 0000000..6538ebf --- /dev/null +++ b/jrpotter/wezterm/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + xdg.configFile."wezterm/wezterm.lua".text = builtins.readFile ./wezterm.lua; +} diff --git a/jrpotter/wezterm/wezterm.lua b/jrpotter/wezterm/wezterm.lua new file mode 100644 index 0000000..a2e3fef --- /dev/null +++ b/jrpotter/wezterm/wezterm.lua @@ -0,0 +1,111 @@ +local wezterm = require('wezterm') + +return { + check_for_updates = false, + keys = { + { + key = ' ', + mods = 'LEADER|CTRL', + action = wezterm.action.ShowLauncher, + }, + { + key = '"', + mods = 'LEADER|SHIFT', + action = wezterm.action.SplitVertical { + domain = 'CurrentPaneDomain', + }, + }, + { + key = '%', + mods = 'LEADER|SHIFT', + action = wezterm.action.SplitHorizontal { + domain = 'CurrentPaneDomain', + }, + }, + { + key = 'h', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Left', + }, + { + key = 'j', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Down', + }, + { + key = 'k', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Up', + }, + { + key = 'l', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Right', + }, + { + key = 'n', + mods = 'LEADER', + action = wezterm.action.ActivateTabRelative(1), + }, + { + key = 'p', + mods = 'LEADER', + action = wezterm.action.ActivateTabRelative(-1), + }, + { + -- Disallow hiding the terminal from the keyboard. + key = 'm', + mods = 'CMD', + action = wezterm.action.DisableDefaultAssignment, + }, + { + key = 'w', + mods = 'LEADER', + action = wezterm.action.ActivateKeyTable { + name = 'resize_mode', + one_shot = false, + replace_current = true, + until_unknown = true, + }, + }, + { + key = 'z', + mods = 'LEADER', + action = wezterm.action.TogglePaneZoomState, + }, + }, + key_tables = { + resize_mode = { + { + key = 'q', + mods = 'NONE', + action = wezterm.action.PopKeyTable, + }, + { + key = 'h', + mods = 'NONE', + action = wezterm.action.AdjustPaneSize { 'Left', 1 }, + }, + { + key = 'j', + mods = 'NONE', + action = wezterm.action.AdjustPaneSize { 'Down', 1 }, + }, + { + key = 'k', + mods = 'NONE', + action = wezterm.action.AdjustPaneSize { 'Up', 1 }, + }, + { + key = 'l', + mods = 'NONE', + action = wezterm.action.AdjustPaneSize { 'Right', 1 }, + }, + }, + }, + leader = { + key = ' ', + mods = 'CTRL', + timeout_milliseconds = 1500, + }, +}