Fix vim editor focus selection issues, cancel vim operators on escape and unbound keys

This commit is contained in:
Keith Simmons 2022-06-30 12:32:53 -07:00
parent 2ee57c1512
commit 66486870aa
12 changed files with 198 additions and 42 deletions

View file

@ -29,8 +29,17 @@ fn editor_focused(EditorFocused(editor): &EditorFocused, cx: &mut MutableAppCont
}
}));
if editor.read(cx).mode() != EditorMode::Full {
vim.switch_mode(Mode::Insert, cx);
if !vim.enabled {
return;
}
let editor = editor.read(cx);
if editor.selections.newest::<usize>(cx).is_empty() {
if editor.mode() != EditorMode::Full {
vim.switch_mode(Mode::Insert, cx);
}
} else {
vim.switch_mode(Mode::Visual { line: false }, cx);
}
});
}