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.

Filter out vim commands when vim mode is disabled

Antonio Scandurrab3baebde22a1
diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs
index a0a12210ec3..cc686f851f2 100644
--- a/crates/vim/src/vim.rs
+++ b/crates/vim/src/vim.rs
@@ -84,7 +84,12 @@ pub fn init(cx: &mut AppContext) {
Vim::active_editor_input_ignored("\n".into(), cx)
});
- // Any time settings change, update vim mode to match.
+ // Any time settings change, update vim mode to match. The Vim struct
+ // will be initialized as disabled by default, so we filter its commands
+ // out when starting up.
+ cx.update_default_global::<CommandPaletteFilter, _, _>(|filter, _| {
+ filter.filtered_namespaces.insert("vim");
+ });
cx.update_default_global(|vim: &mut Vim, cx: &mut AppContext| {
vim.set_enabled(cx.global::<Settings>().vim_mode, cx)
});