Add a next_mode to vim::Paste instead of hard-coding Normal mode (#27897)

jneem created

This adds a `next_mode` parameter to the `vim::Paste` action. My main
use-case for this is for helix users, who will want to switch into
`HelixNormal` mode instead of `Normal` mode.

I'm not sure if this is the best approach -- another possibility would
be to have a global vim-vs-helix configuration, and then have every
invocation of "normal" mode choose vim or helix based on that global
configuration. But the approach in this PR is much less invasive.

Release Notes:

- vim: switch to the configured default mode after paste instead of
hard-coding Normal mode

Change summary

crates/vim/src/normal/paste.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

crates/vim/src/normal/paste.rs 🔗

@@ -3,10 +3,11 @@ use gpui::{Context, Window, impl_actions};
 use language::{Bias, SelectionGoal};
 use schemars::JsonSchema;
 use serde::Deserialize;
+use settings::Settings;
 use std::cmp;
 
 use crate::{
-    Vim,
+    Vim, VimSettings,
     motion::{Motion, MotionKind},
     object::Object,
     state::{Mode, Register},
@@ -203,7 +204,8 @@ impl Vim {
                 })
             });
         });
-        self.switch_mode(Mode::Normal, true, window, cx);
+        let next_mode = VimSettings::get_global(cx).default_mode;
+        self.switch_mode(next_mode, true, window, cx);
     }
 
     pub fn replace_with_register_object(