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:
Keith Simmons 2022-03-25 20:05:46 -07:00
parent 0aaf270650
commit 1a29180185
11 changed files with 192 additions and 194 deletions

View file

@ -13,9 +13,7 @@ pub fn init(cx: &mut MutableAppContext) {
fn editor_created(EditorCreated(editor): &EditorCreated, cx: &mut MutableAppContext) {
cx.update_default_global(|vim_state: &mut VimState, cx| {
vim_state.editors.insert(editor.id(), editor.downgrade());
if vim_state.enabled {
VimState::update_cursor_shapes(cx);
}
VimState::sync_editor_options(cx);
})
}
@ -40,9 +38,7 @@ fn editor_blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut MutableAppCont
}
}
});
editor.update(cx, |editor, _| {
editor.remove_keymap_context_layer::<VimState>();
})
VimState::sync_editor_options(cx);
}
fn editor_released(EditorReleased(editor): &EditorReleased, cx: &mut MutableAppContext) {