Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

disable vim mode in non full editors

Kay Simmonsc3518cefe832
diff --git a/crates/vim/src/editor_events.rs b/crates/vim/src/editor_events.rs
index 7b777a50edd..c526e3b1dc7 100644
--- a/crates/vim/src/editor_events.rs
+++ b/crates/vim/src/editor_events.rs
@@ -37,9 +37,7 @@ fn editor_focused(EditorFocused(editor): &EditorFocused, cx: &mut MutableAppCont
let editor_mode = editor.mode();
let newest_selection_empty = editor.selections.newest::<usize>(cx).is_empty();
- if editor_mode != EditorMode::Full {
- vim.switch_mode(Mode::Insert, true, cx);
- } else if !newest_selection_empty {
+ if editor_mode == EditorMode::Full && !newest_selection_empty {
vim.switch_mode(Mode::Visual { line: false }, true, cx);
}
});
diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs
index 8c5dae1e01f..9f799ef37f9 100644
--- a/crates/vim/src/vim.rs
+++ b/crates/vim/src/vim.rs
@@ -12,7 +12,7 @@ mod visual;
use collections::HashMap;
use command_palette::CommandPaletteFilter;
-use editor::{Bias, Cancel, Editor};
+use editor::{Bias, Cancel, Editor, EditorMode};
use gpui::{
impl_actions,
keymap_matcher::{KeyPressed, Keystroke},
@@ -267,7 +267,7 @@ impl Vim {
for editor in self.editors.values() {
if let Some(editor) = editor.upgrade(cx) {
editor.update(cx, |editor, cx| {
- if self.enabled {
+ if self.enabled && editor.mode() == EditorMode::Full {
editor.set_cursor_shape(cursor_shape, cx);
editor.set_clip_at_line_ends(state.clip_at_line_end(), cx);
editor.set_input_enabled(!state.vim_controlled());