Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
fix sqlez warning, introduce tab and enter bindings to vim for inputing tab and enter text when waiting for text
Kay Simmons459060764a3c
diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.jsonindex e8a7d767f04..824fb63c0f3 100644--- a/assets/keymaps/vim.json+++ b/assets/keymaps/vim.json@@ -315,7 +315,8 @@{"context": "Editor && VimWaiting","bindings": {- // "*": "gpui::KeyPressed",+ "tab": "vim::Tab",+ "enter": "vim::Enter","escape": "editor::Cancel"}}diff --git a/crates/sqlez/src/migrations.rs b/crates/sqlez/src/migrations.rsindex b3aaef95b1d..b8e589e268c 100644--- a/crates/sqlez/src/migrations.rs+++ b/crates/sqlez/src/migrations.rs@@ -83,7 +83,6 @@ impl Connection {#[cfg(test)]mod test {use indoc::indoc;- use sqlez_macros::sql;use crate::connection::Connection;@@ -288,21 +287,18 @@ mod test {let connection = Connection::open_memory(Some("test_create_alter_drop"));connection- .migrate(- "first_migration",- &[sql!( CREATE TABLE table1(a TEXT) STRICT; )],- )+ .migrate("first_migration", &["CREATE TABLE table1(a TEXT) STRICT;"]).unwrap();connection- .exec(sql!( INSERT INTO table1(a) VALUES ("test text"); ))+ .exec("INSERT INTO table1(a) VALUES (\"test text\");").unwrap()().unwrap();connection.migrate("second_migration",- &[sql!(+ &[indoc! {"CREATE TABLE table2(b TEXT) STRICT;INSERT INTO table2 (b)@@ -311,16 +307,11 @@ mod test {DROP TABLE table1;ALTER TABLE table2 RENAME TO table1;- )],+ "}],).unwrap();- let res = &connection- .select::<String>(sql!(- SELECT b FROM table1- ))- .unwrap()()- .unwrap()[0];+ let res = &connection.select::<String>("SELECT b FROM table1").unwrap()().unwrap()[0];assert_eq!(res, "test text");}diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rsindex 9fe99696803..33f142c21e6 100644--- a/crates/vim/src/vim.rs+++ b/crates/vim/src/vim.rs@@ -15,7 +15,7 @@ use std::sync::Arc;use command_palette::CommandPaletteFilter;use editor::{Bias, Cancel, Editor, EditorMode};use gpui::{- impl_actions, MutableAppContext, Subscription, ViewContext, ViewHandle, WeakViewHandle,+ actions, impl_actions, MutableAppContext, Subscription, ViewContext, ViewHandle, WeakViewHandle,};use language::CursorShape;use motion::Motion;@@ -35,6 +35,7 @@ pub struct PushOperator(pub Operator);#[derive(Clone, Deserialize, PartialEq)]struct Number(u8);+actions!(vim, [Tab, Enter]);impl_actions!(vim, [Number, SwitchMode, PushOperator]);pub fn init(cx: &mut MutableAppContext) {@@ -74,8 +75,16 @@ pub fn init(cx: &mut MutableAppContext) {}});+ cx.add_action(|_: &mut Workspace, _: &Tab, cx| {+ Vim::active_editor_input_ignored(" ".into(), cx)+ });++ cx.add_action(|_: &mut Workspace, _: &Enter, cx| {+ Vim::active_editor_input_ignored("\n".into(), cx)+ });+// Sync initial settings with the rest of the app- Vim::update(cx, |state, cx| state.sync_vim_settings(cx));+ Vim::update(cx, |vim, cx| vim.sync_vim_settings(cx));// Any time settings change, update vim mode to matchcx.observe_global::<Settings, _>(|cx| {@@ -99,7 +108,9 @@ pub fn observe_keystrokes(window_id: usize, cx: &mut MutableAppContext) {}Vim::update(cx, |vim, cx| match vim.active_operator() {- Some(Operator::FindForward { .. } | Operator::FindBackward { .. }) => {}+ Some(+ Operator::FindForward { .. } | Operator::FindBackward { .. } | Operator::Replace,+ ) => {}Some(_) => {vim.clear_operator(cx);}