diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 4786a4db2229a92782766adf1ca735ed992d917e..04eb4aef8effa7623fdea89e7878e233525c3915 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -838,6 +838,19 @@ "tab": "editor::AcceptEditPrediction" } }, + { + "context": "MessageEditor > Editor && VimControl", + "bindings": { + "enter": "agent::Chat", + // TODO: Implement search + "/": null, + "?": null, + "#": null, + "*": null, + "n": null, + "shift-n": null + } + }, { "context": "os != macos && Editor && edit_prediction_conflict", "bindings": { diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs index 53d1d2d189e4925ddde1d1bac842fabf16a4e21d..9e3467cca6676d6ecfb3c5d542b8df5af7c8e407 100644 --- a/crates/agent/src/message_editor.rs +++ b/crates/agent/src/message_editor.rs @@ -112,6 +112,7 @@ pub(crate) fn create_editor( editor.set_placeholder_text("Message the agent – @ to include context", cx); editor.set_show_indent_guides(false, cx); editor.set_soft_wrap(); + editor.set_use_modal_editing(true); editor.set_context_menu_options(ContextMenuOptions { min_entries_visible: 12, max_entries_visible: 12, diff --git a/crates/vim/src/test/vim_test_context.rs b/crates/vim/src/test/vim_test_context.rs index 188ae1c248761ee86ad80c85d5d397c37415a6dd..f8acecc9b103426f25b805bd16460275e9edd2f1 100644 --- a/crates/vim/src/test/vim_test_context.rs +++ b/crates/vim/src/test/vim_test_context.rs @@ -1,11 +1,13 @@ use std::ops::{Deref, DerefMut}; use editor::test::editor_lsp_test_context::EditorLspTestContext; -use gpui::{Context, Entity, SemanticVersion, UpdateGlobal}; +use gpui::{Context, Entity, SemanticVersion, UpdateGlobal, actions}; use search::{BufferSearchBar, project_search::ProjectSearchBar}; use crate::{state::Operator, *}; +actions!(agent, [Chat]); + pub struct VimTestContext { cx: EditorLspTestContext, } diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index 891fb8c15756f8fd14508babc52b48b15cb5fbe7..88bd2fb744e0c48b0b58bf71af40d4225c86076a 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -433,6 +433,12 @@ impl Vim { fn activate(editor: &mut Editor, window: &mut Window, cx: &mut Context) { let vim = Vim::new(window, cx); + if !editor.mode().is_full() { + vim.update(cx, |vim, _| { + vim.mode = Mode::Insert; + }); + } + editor.register_addon(VimAddon { entity: vim.clone(), });