Add a next_mode to vim::Paste instead of hard-coding Normal mode (#27897)
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
This commit is contained in:
parent
b9051e65d4
commit
9949512b64
1 changed files with 4 additions and 2 deletions
|
@ -3,10 +3,11 @@ use gpui::{Context, Window, impl_actions};
|
||||||
use language::{Bias, SelectionGoal};
|
use language::{Bias, SelectionGoal};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use settings::Settings;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Vim,
|
Vim, VimSettings,
|
||||||
motion::{Motion, MotionKind},
|
motion::{Motion, MotionKind},
|
||||||
object::Object,
|
object::Object,
|
||||||
state::{Mode, Register},
|
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(
|
pub fn replace_with_register_object(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue