From fcbdfe849f0bc7ea695d65b061229bc67ea5ef32 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 4 May 2023 15:00:19 +0200 Subject: [PATCH] Merge pull request #2442 from zed-industries/filter-vim-commands Filter out vim commands when vim mode is disabled --- crates/vim/src/vim.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index a0a12210ec36d73a6fd468331622231f2b7802c0..cc686f851f21c7019c76a43840cea70a8d6f32de 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::(|filter, _| { + filter.filtered_namespaces.insert("vim"); + }); cx.update_default_global(|vim: &mut Vim, cx: &mut AppContext| { vim.set_enabled(cx.global::().vim_mode, cx) });