From d1baff1743757c1e63f90a477ca19eb7f18af352 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 27 Sep 2023 21:04:13 -0600 Subject: [PATCH 1/4] Add ctrl-i to go forward For zed-industries/community#1732 --- assets/keymaps/vim.json | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 5362f7c0e5..09a86b1ff5 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -95,6 +95,7 @@ } ], "ctrl-o": "pane::GoBack", + "ctrl-i": "pane::GoForward", "ctrl-]": "editor::GoToDefinition", "escape": [ "vim::SwitchMode", From 73fc1c1c56220df3e40cf31e4cca5ed754b1e2a2 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 27 Sep 2023 21:05:58 -0600 Subject: [PATCH 2/4] Add `g space` for option-enter vimify all the things --- assets/keymaps/vim.json | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 09a86b1ff5..dedc05c612 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -146,6 +146,7 @@ "g shift-s": "project_symbols::Toggle", "g .": "editor::ToggleCodeActions", // zed specific "g shift-a": "editor::FindAllReferences", // zed specific + "g space": "editor::OpenExcerpts", // zed specific "g *": [ "vim::MoveToNext", { From 2cb320e2463c3bb317d68b9ac0b8169d2d156e62 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 27 Sep 2023 21:28:30 -0600 Subject: [PATCH 3/4] Escape returns to normal mode even if completion is open For zed-industries/community#1746 --- assets/keymaps/vim.json | 2 +- crates/vim/src/insert.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index dedc05c612..4dbc4ce17f 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -568,7 +568,7 @@ } }, { - "context": "Editor && vim_mode == insert && !menu", + "context": "Editor && vim_mode == insert", "bindings": { "escape": "vim::NormalBefore", "ctrl-c": "vim::NormalBefore", diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index fb567fab6a..ec2b8b50c9 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -16,6 +16,7 @@ fn normal_before(_: &mut Workspace, action: &NormalBefore, cx: &mut ViewContext< vim.stop_recording_immediately(action.boxed_clone()); if count <= 1 || vim.workspace_state.replaying { vim.update_active_editor(cx, |editor, cx| { + editor.cancel(&Default::default(), cx); editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.move_cursors_with(|map, mut cursor, _| { *cursor.column_mut() = cursor.column().saturating_sub(1); From 51b24bbaf369c18886989e427764d5644e6eca6f Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 27 Sep 2023 21:29:18 -0600 Subject: [PATCH 4/4] Add vim-style completion bindings: --- assets/keymaps/vim.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 4dbc4ce17f..f5d11dab99 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -572,7 +572,12 @@ "bindings": { "escape": "vim::NormalBefore", "ctrl-c": "vim::NormalBefore", - "ctrl-[": "vim::NormalBefore" + "ctrl-[": "vim::NormalBefore", + "ctrl-x ctrl-o": "editor::ShowCompletions", + "ctrl-x ctrl-a": "assistant::InlineAssist", // zed specific + "ctrl-x ctrl-c": "copilot::Suggest", // zed specific + "ctrl-x ctrl-l": "editor::ToggleCodeActions", // zed specific + "ctrl-x ctrl-z": "editor::Cancel" } }, {