Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
vim: add guu gUU g~~ g/ (#12789)
Conrad Irwin75f8be6a0f71
diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.jsonindex 9b6d0819d65..08da79078af 100644--- a/assets/keymaps/vim.json+++ b/assets/keymaps/vim.json@@ -80,6 +80,7 @@"g shift-e": ["vim::PreviousWordEnd", { "ignorePunctuation": true }],"/": "vim::Search",+ "g /": "pane::DeploySearch","?": ["vim::Search",{@@ -433,6 +434,27 @@"d": "vim::CurrentLine"}},+ {+ "context": "Editor && vim_operator == gu",+ "bindings": {+ "g u": "vim::CurrentLine",+ "u": "vim::CurrentLine"+ }+ },+ {+ "context": "Editor && vim_operator == gU",+ "bindings": {+ "g shift-u": "vim::CurrentLine",+ "shift-u": "vim::CurrentLine"+ }+ },+ {+ "context": "Editor && vim_operator == g~",+ "bindings": {+ "g ~": "vim::CurrentLine",+ "~": "vim::CurrentLine"+ }+ },{"context": "Editor && vim_mode == normal && vim_operator == d","bindings": {diff --git a/crates/gpui/src/keymap/context.rs b/crates/gpui/src/keymap/context.rsindex 17dba496bd4..dbe0e10b8dd 100644--- a/crates/gpui/src/keymap/context.rs+++ b/crates/gpui/src/keymap/context.rs@@ -295,7 +295,7 @@ impl KeyBindingContextPredicate {}_ if is_identifier_char(next) => {let len = source- .find(|c: char| !is_identifier_char(c))+ .find(|c: char| !is_identifier_char(c) && !is_vim_operator_char(c)).unwrap_or(source.len());let (identifier, rest) = source.split_at(len);source = skip_whitespace(rest);@@ -356,7 +356,7 @@ fn is_identifier_char(c: char) -> bool {}fn is_vim_operator_char(c: char) -> bool {- c == '>' || c == '<'+ c == '>' || c == '<' || c == '~'}fn skip_whitespace(source: &str) -> &str {diff --git a/docs/src/vim.md b/docs/src/vim.mdindex 7f2f9526641..d97d3a9113e 100644--- a/docs/src/vim.md+++ b/docs/src/vim.md@@ -48,12 +48,14 @@ g < The same, but backwardsg a Add a visual selection for every copy of the current word# Pane management+g / Open a project-wide searchg <space> Open the current search excerpt<ctrl-w> <space> Open the current search excerpt in a split<ctrl-w> g d Go to definition in a split<ctrl-w> g D Go to type definition in a split# Insert mode+i a / a a Select the function argument the cursor is inctrl-x ctrl-o Open the completion menuctrl-x ctrl-c Request GitHub Copilot suggestion (if configured)ctrl-x ctrl-a Open the inline AI assistant (if configured)