Fixed issue with enabling and disabling vim mode dynamically
Also added indoc and marked text utility to vim tests to improve readability
This commit is contained in:
parent
0aaf270650
commit
1a29180185
11 changed files with 192 additions and 194 deletions
|
@ -3,7 +3,7 @@ use gpui::{action, keymap::Binding, MutableAppContext, ViewContext};
|
|||
use language::SelectionGoal;
|
||||
use workspace::Workspace;
|
||||
|
||||
use crate::{editor_utils::VimEditorExt, mode::Mode, SwitchMode, VimState};
|
||||
use crate::{mode::Mode, SwitchMode, VimState};
|
||||
|
||||
action!(NormalBefore);
|
||||
|
||||
|
@ -18,11 +18,11 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
}
|
||||
|
||||
fn normal_before(_: &mut Workspace, _: &NormalBefore, cx: &mut ViewContext<Workspace>) {
|
||||
VimState::switch_mode(&SwitchMode(Mode::Normal), cx);
|
||||
VimState::update_active_editor(cx, |editor, cx| {
|
||||
editor.clipped_move_cursors(cx, |map, mut cursor, _| {
|
||||
editor.move_cursors(cx, |map, mut cursor, _| {
|
||||
*cursor.column_mut() = cursor.column().saturating_sub(1);
|
||||
(map.clip_point(cursor, Bias::Left), SelectionGoal::None)
|
||||
});
|
||||
});
|
||||
VimState::switch_mode(&SwitchMode(Mode::Normal), cx);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue