From e1afac2855bd5113a2ee2a268795414a5fcbc744 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Sun, 17 Aug 2025 01:09:05 +0530 Subject: [PATCH] feat: Added more keybinds from vim to zed --- home/apps/zed.nix | 50 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/home/apps/zed.nix b/home/apps/zed.nix index 943ac704..16dd023b 100644 --- a/home/apps/zed.nix +++ b/home/apps/zed.nix @@ -20,15 +20,33 @@ "javascript" "typescript" ]; - userKeymaps = [ - { - context = "Workspace"; - bindings = { + userKeymaps = let + # keymaps should be like this: + # ```nix + # { + # "Workspace" = { + # "ctrl-\\" = "workspace::ToggleBottomDock"; + # "ctrl-h" = "editor::Backspace"; + # }; + # } + # ``` + mkMap = keymaps: + lib.mapAttrsToList (context: bindings: { + inherit context; + inherit bindings; + # use_key_equivalents = true; + }) + keymaps; + in + mkMap { + "Workspace" = { "ctrl-\\" = "workspace::ToggleBottomDock"; "ctrl-shift-r" = "workspace::ToggleRightDock"; + "ctrl-b" = "workspace::ToggleLeftDock"; "ctrl-k" = "editor::GoToDefinition"; "ctrl-n" = null; "ctrl-p" = null; + "ctrl-shift-h" = null; "space f f" = [ "task::Spawn" { @@ -51,26 +69,26 @@ } ]; }; - } - { - context = "Editor"; - use_key_equivalents = true; - bindings = { - "ctrl-shift-r" = "workspace::ToggleRightDock"; + "Editor" = { "ctrl-k" = "editor::GoToDefinition"; "ctrl-t" = "pane::GoBack"; "ctrl-l" = "editor::AcceptEditPrediction"; "ctrl-\\" = "workspace::ToggleBottomDock"; + "ctrl-b" = "workspace::ToggleLeftDock"; + "space n" = "pane::ActivateNextItem"; + "space p" = "pane::ActivatePreviousItem"; + "space space" = "pane::ActivateLastItem"; + "space q" = "pane::CloseActiveItem"; }; - } - { - context = "vim_mode == insert"; - bindings = { + "vim_mode == insert" = { "ctrl-k" = "editor::GoToDefinition"; "ctrl-l" = "editor::AcceptEditPrediction"; + "ctrl-h" = "editor::Backspace"; + "space f f" = null; + "space f g" = null; + "space g g" = null; }; - } - ]; + }; userSettings = { features = { edit_prediction_provider = "copilot";