From 034d905435ea357e0ff847b0f8e1140dfb7aba38 Mon Sep 17 00:00:00 2001 From: Matt Fellenz Date: Mon, 8 Jul 2024 22:16:52 -0700 Subject: [PATCH] Allow vim counts with undo and redo (#13950) These were previously passed directly to the editor module, which knows nothing about vim counts. Instead, implement new actions in the vim module which take the count and use it to invoke the corresponding action in the editor module, properly repeated. Release Notes: - Fixed vim undo and redo commands not taking counts. --- assets/keymaps/vim.json | 4 ++-- crates/vim/src/normal.rs | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index a44c9af4c16fda04a133849f1b8a8933e38c7180..0e98636e4164a2eba8ae134555f328d528ed541f 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -232,8 +232,8 @@ "ctrl-x": "vim::Decrement", "p": "vim::Paste", "shift-p": ["vim::Paste", { "before": true }], - "u": "editor::Undo", - "ctrl-r": "editor::Redo", + "u": "vim::Undo", + "ctrl-r": "vim::Redo", "r": ["vim::PushOperator", "Replace"], "s": "vim::Substitute", "shift-s": "vim::SubstituteLine", diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 1daf7ef017d8ac480f66f72d28a887511a222622..781c6bb98a99ddd3ab3fe63330bdfbd9b1a68535 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -65,6 +65,8 @@ actions!( Indent, Outdent, ToggleComments, + Undo, + Redo, ] ); @@ -180,6 +182,27 @@ pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext