vim.json

  1[
  2  {
  3    "context": "VimControl && !menu",
  4    "bindings": {
  5      "i": ["vim::PushObject", { "around": false }],
  6      "a": ["vim::PushObject", { "around": true }],
  7      "left": "vim::Left",
  8      "h": "vim::Left",
  9      "backspace": "vim::WrappingLeft",
 10      "down": "vim::Down",
 11      "ctrl-j": "vim::Down",
 12      "j": "vim::Down",
 13      "ctrl-m": "vim::NextLineStart",
 14      "+": "vim::NextLineStart",
 15      "enter": "vim::NextLineStart",
 16      "-": "vim::PreviousLineStart",
 17      "shift-tab": "vim::Tab",
 18      "tab": "vim::Tab",
 19      "up": "vim::Up",
 20      "k": "vim::Up",
 21      "right": "vim::Right",
 22      "l": "vim::Right",
 23      "space": "vim::WrappingRight",
 24      "end": "vim::EndOfLine",
 25      "$": "vim::EndOfLine",
 26      "^": "vim::FirstNonWhitespace",
 27      "_": "vim::StartOfLineDownward",
 28      "g _": "vim::EndOfLineDownward",
 29      "shift-g": "vim::EndOfDocument",
 30      "{": "vim::StartOfParagraph",
 31      "}": "vim::EndOfParagraph",
 32      "(": "vim::SentenceBackward",
 33      ")": "vim::SentenceForward",
 34      "|": "vim::GoToColumn",
 35
 36      // Word motions
 37      "w": "vim::NextWordStart",
 38      "e": "vim::NextWordEnd",
 39      "b": "vim::PreviousWordStart",
 40      "g e": "vim::PreviousWordEnd",
 41      // Subword motions
 42      // "w": "vim::NextSubwordStart",
 43      // "b": "vim::PreviousSubwordStart",
 44      // "e": "vim::NextSubwordEnd",
 45      // "g e": "vim::PreviousSubwordEnd",
 46      "shift-w": ["vim::NextWordStart", { "ignore_punctuation": true }],
 47      "shift-e": ["vim::NextWordEnd", { "ignore_punctuation": true }],
 48      "shift-b": ["vim::PreviousWordStart", { "ignore_punctuation": true }],
 49      "g shift-e": ["vim::PreviousWordEnd", { "ignore_punctuation": true }],
 50      "/": "vim::Search",
 51      "g /": "pane::DeploySearch",
 52      "?": ["vim::Search", { "backwards": true }],
 53      "*": "vim::MoveToNext",
 54      "#": "vim::MoveToPrevious",
 55      "n": "vim::MoveToNextMatch",
 56      "shift-n": "vim::MoveToPreviousMatch",
 57      "%": "vim::Matching",
 58      "f": ["vim::PushFindForward", { "before": false, "multiline": false }],
 59      "t": ["vim::PushFindForward", { "before": true, "multiline": false }],
 60      "shift-f": ["vim::PushFindBackward", { "after": false, "multiline": false }],
 61      "shift-t": ["vim::PushFindBackward", { "after": true, "multiline": false }],
 62      "m": "vim::PushMark",
 63      "'": ["vim::PushJump", { "line": true }],
 64      "`": ["vim::PushJump", { "line": false }],
 65      ";": "vim::RepeatFind",
 66      ",": "vim::RepeatFindReversed",
 67      "ctrl-o": "pane::GoBack",
 68      "ctrl-i": "pane::GoForward",
 69      "ctrl-]": "editor::GoToDefinition",
 70      "escape": "vim::SwitchToNormalMode",
 71      "ctrl-[": "vim::SwitchToNormalMode",
 72      "v": "vim::ToggleVisual",
 73      "shift-v": "vim::ToggleVisualLine",
 74      "ctrl-g": "vim::ShowLocation",
 75      "ctrl-v": "vim::ToggleVisualBlock",
 76      "ctrl-q": "vim::ToggleVisualBlock",
 77      "shift-k": "editor::Hover",
 78      "shift-r": "vim::ToggleReplace",
 79      "0": "vim::StartOfLine",
 80      "home": "vim::StartOfLine",
 81      "ctrl-f": "vim::PageDown",
 82      "pagedown": "vim::PageDown",
 83      "ctrl-b": "vim::PageUp",
 84      "pageup": "vim::PageUp",
 85      "ctrl-d": "vim::ScrollDown",
 86      "ctrl-u": "vim::ScrollUp",
 87      "ctrl-e": "vim::LineDown",
 88      "ctrl-y": "vim::LineUp",
 89      // "g" commands
 90      "g shift-r": "vim::PushReplaceWithRegister",
 91      "g r n": "editor::Rename",
 92      "g r r": "editor::FindAllReferences",
 93      "g r i": "editor::GoToImplementation",
 94      "g r a": "editor::ToggleCodeActions",
 95      "g g": "vim::StartOfDocument",
 96      "g h": "editor::Hover",
 97      "g B": "editor::BlameHover",
 98      "g t": "vim::GoToTab",
 99      "g shift-t": "vim::GoToPreviousTab",
100      "g d": "editor::GoToDefinition",
101      "g shift-d": "editor::GoToDeclaration",
102      "g y": "editor::GoToTypeDefinition",
103      "g shift-i": "editor::GoToImplementation",
104      "g x": "editor::OpenUrl",
105      "g f": "editor::OpenSelectedFilename",
106      "g n": "vim::SelectNextMatch",
107      "g shift-n": "vim::SelectPreviousMatch",
108      "g l": "vim::SelectNext",
109      "g shift-l": "vim::SelectPrevious",
110      "g >": ["editor::SelectNext", { "replace_newest": true }],
111      "g <": ["editor::SelectPrevious", { "replace_newest": true }],
112      "g a": "editor::SelectAllMatches",
113      "g s": "outline::Toggle",
114      "g shift-o": "outline::Toggle",
115      "g shift-s": "project_symbols::Toggle",
116      "g .": "editor::ToggleCodeActions", // zed specific
117      "g shift-a": "editor::FindAllReferences", // zed specific
118      "g space": "editor::OpenExcerpts", // zed specific
119      "g *": ["vim::MoveToNext", { "partial_word": true }],
120      "g #": ["vim::MoveToPrevious", { "partial_word": true }],
121      "g j": ["vim::Down", { "display_lines": true }],
122      "g down": ["vim::Down", { "display_lines": true }],
123      "g k": ["vim::Up", { "display_lines": true }],
124      "g up": ["vim::Up", { "display_lines": true }],
125      "g $": ["vim::EndOfLine", { "display_lines": true }],
126      "g end": ["vim::EndOfLine", { "display_lines": true }],
127      "g 0": ["vim::StartOfLine", { "display_lines": true }],
128      "g home": ["vim::StartOfLine", { "display_lines": true }],
129      "g shift-m": ["vim::MiddleOfLine", { "display_lines": true }],
130      "g ^": ["vim::FirstNonWhitespace", { "display_lines": true }],
131      "g v": "vim::RestoreVisualSelection",
132      "g ]": "editor::GoToDiagnostic",
133      "g [": "editor::GoToPreviousDiagnostic",
134      "g i": "vim::InsertAtPrevious",
135      "g ,": "vim::ChangeListNewer",
136      "g ;": "vim::ChangeListOlder",
137      "shift-h": "vim::WindowTop",
138      "shift-m": "vim::WindowMiddle",
139      "shift-l": "vim::WindowBottom",
140      "q": "vim::ToggleRecord",
141      "shift-q": "vim::ReplayLastRecording",
142      "@": "vim::PushReplayRegister",
143      // z commands
144      "z enter": ["workspace::SendKeystrokes", "z t ^"],
145      "z -": ["workspace::SendKeystrokes", "z b ^"],
146      "z ^": ["workspace::SendKeystrokes", "shift-h k z b ^"],
147      "z +": ["workspace::SendKeystrokes", "shift-l j z t ^"],
148      "z t": "editor::ScrollCursorTop",
149      "z z": "editor::ScrollCursorCenter",
150      "z .": ["workspace::SendKeystrokes", "z z ^"],
151      "z b": "editor::ScrollCursorBottom",
152      "z a": "editor::ToggleFold",
153      "z shift-a": "editor::ToggleFoldRecursive",
154      "z c": "editor::Fold",
155      "z shift-c": "editor::FoldRecursive",
156      "z o": "editor::UnfoldLines",
157      "z shift-o": "editor::UnfoldRecursive",
158      "z f": "editor::FoldSelectedRanges",
159      "z shift-m": "editor::FoldAll",
160      "z shift-r": "editor::UnfoldAll",
161      "z l": "vim::ColumnRight",
162      "z h": "vim::ColumnLeft",
163      "z shift-l": "vim::HalfPageRight",
164      "z shift-h": "vim::HalfPageLeft",
165      "shift-z shift-q": ["pane::CloseActiveItem", { "save_intent": "skip" }],
166      "shift-z shift-z": ["pane::CloseActiveItem", { "save_intent": "save_all" }],
167      // Count support
168      "1": ["vim::Number", 1],
169      "2": ["vim::Number", 2],
170      "3": ["vim::Number", 3],
171      "4": ["vim::Number", 4],
172      "5": ["vim::Number", 5],
173      "6": ["vim::Number", 6],
174      "7": ["vim::Number", 7],
175      "8": ["vim::Number", 8],
176      "9": ["vim::Number", 9],
177      "ctrl-w d": "editor::GoToDefinitionSplit",
178      "ctrl-w g d": "editor::GoToDefinitionSplit",
179      "ctrl-w ]": "editor::GoToDefinitionSplit",
180      "ctrl-w ctrl-]": "editor::GoToDefinitionSplit",
181      "ctrl-w shift-d": "editor::GoToTypeDefinitionSplit",
182      "ctrl-w g shift-d": "editor::GoToTypeDefinitionSplit",
183      "ctrl-w space": "editor::OpenExcerptsSplit",
184      "ctrl-w g space": "editor::OpenExcerptsSplit",
185      "ctrl-6": "pane::AlternateFile",
186      "ctrl-^": "pane::AlternateFile",
187      ".": "vim::Repeat"
188    }
189  },
190  {
191    "context": "vim_mode == normal || vim_mode == visual || vim_mode == operator",
192    "bindings": {
193      "] ]": "vim::NextSectionStart",
194      "] [": "vim::NextSectionEnd",
195      "[ [": "vim::PreviousSectionStart",
196      "[ ]": "vim::PreviousSectionEnd",
197      "] m": "vim::NextMethodStart",
198      "] shift-m": "vim::NextMethodEnd",
199      "[ m": "vim::PreviousMethodStart",
200      "[ shift-m": "vim::PreviousMethodEnd",
201      "[ *": "vim::PreviousComment",
202      "[ /": "vim::PreviousComment",
203      "] *": "vim::NextComment",
204      "] /": "vim::NextComment",
205      "[ -": "vim::PreviousLesserIndent",
206      "[ +": "vim::PreviousGreaterIndent",
207      "[ =": "vim::PreviousSameIndent",
208      "] -": "vim::NextLesserIndent",
209      "] +": "vim::NextGreaterIndent",
210      "] =": "vim::NextSameIndent",
211      "] b": "pane::ActivateNextItem",
212      "[ b": "pane::ActivatePreviousItem",
213      "] shift-b": "pane::ActivateLastItem",
214      "[ shift-b": ["pane::ActivateItem", 0],
215      "] space": "vim::InsertEmptyLineBelow",
216      "[ space": "vim::InsertEmptyLineAbove",
217      "[ e": "editor::MoveLineUp",
218      "] e": "editor::MoveLineDown",
219      "[ f": "workspace::FollowNextCollaborator",
220      "] f": "workspace::FollowNextCollaborator",
221      "] }": ["vim::UnmatchedForward", { "char": "}" }],
222      "[ {": ["vim::UnmatchedBackward", { "char": "{" }],
223      "] )": ["vim::UnmatchedForward", { "char": ")" }],
224      "[ (": ["vim::UnmatchedBackward", { "char": "(" }],
225      // tree-sitter related commands
226      "[ x": "vim::SelectLargerSyntaxNode",
227      "] x": "vim::SelectSmallerSyntaxNode"
228    }
229  },
230  {
231    "context": "vim_mode == normal",
232    "bindings": {
233      "i": "vim::InsertBefore",
234      "a": "vim::InsertAfter",
235      "ctrl-[": "editor::Cancel",
236      ":": "command_palette::Toggle",
237      "c": "vim::PushChange",
238      "shift-c": "vim::ChangeToEndOfLine",
239      "d": "vim::PushDelete",
240      "delete": "vim::DeleteRight",
241      "g shift-j": "vim::JoinLinesNoWhitespace",
242      "y": "vim::PushYank",
243      "x": "vim::DeleteRight",
244      "shift-x": "vim::DeleteLeft",
245      "ctrl-a": "vim::Increment",
246      "ctrl-x": "vim::Decrement",
247      "ctrl-r": "vim::Redo",
248      ">": "vim::PushIndent",
249      "<": "vim::PushOutdent",
250      "=": "vim::PushAutoIndent",
251      "!": "vim::PushShellCommand",
252      "g u": "vim::PushLowercase",
253      "g shift-u": "vim::PushUppercase",
254      "g ~": "vim::PushOppositeCase",
255      "g ?": "vim::PushRot13",
256      // "g ?": "vim::PushRot47",
257      "g w": "vim::PushRewrap",
258      "g q": "vim::PushRewrap",
259      "insert": "vim::InsertBefore",
260      "] d": "editor::GoToDiagnostic",
261      "[ d": "editor::GoToPreviousDiagnostic",
262      "] c": "editor::GoToHunk",
263      "[ c": "editor::GoToPreviousHunk",
264      "g c": "vim::PushToggleComments"
265    }
266  },
267  {
268    "context": "VimControl && VimCount",
269    "bindings": {
270      "0": ["vim::Number", 0],
271      ":": "vim::CountCommand",
272      "%": "vim::GoToPercentage"
273    }
274  },
275  {
276    "context": "vim_mode == visual",
277    "bindings": {
278      ":": "vim::VisualCommand",
279      "u": "vim::ConvertToLowerCase",
280      "shift-u": "vim::ConvertToUpperCase",
281      "shift-o": "vim::OtherEnd",
282      "o": "vim::OtherEndRowAware",
283      "d": "vim::VisualDelete",
284      "x": "vim::VisualDelete",
285      "delete": "vim::VisualDelete",
286      "shift-d": "vim::VisualDeleteLine",
287      "shift-x": "vim::VisualDeleteLine",
288      "y": "vim::VisualYank",
289      "shift-y": "vim::VisualYankLine",
290      "p": "vim::Paste",
291      "shift-p": ["vim::Paste", { "preserve_clipboard": true }],
292      "c": "vim::Substitute",
293      "s": "vim::Substitute",
294      "shift-r": "vim::SubstituteLine",
295      "shift-s": "vim::SubstituteLine",
296      "~": "vim::ChangeCase",
297      "*": ["vim::MoveToNext", { "partial_word": true }],
298      "#": ["vim::MoveToPrevious", { "partial_word": true }],
299      "ctrl-a": "vim::Increment",
300      "ctrl-x": "vim::Decrement",
301      "g ctrl-a": ["vim::Increment", { "step": true }],
302      "g ctrl-x": ["vim::Decrement", { "step": true }],
303      "shift-i": "vim::InsertBefore",
304      "shift-a": "vim::InsertAfter",
305      "g shift-i": "vim::VisualInsertFirstNonWhiteSpace",
306      "g shift-a": "vim::VisualInsertEndOfLine",
307      "shift-j": "vim::JoinLines",
308      "g shift-j": "vim::JoinLinesNoWhitespace",
309      "r": "vim::PushReplace",
310      "ctrl-c": "vim::SwitchToNormalMode",
311      "ctrl-[": "vim::SwitchToNormalMode",
312      "escape": "vim::SwitchToNormalMode",
313      ">": "vim::Indent",
314      "<": "vim::Outdent",
315      "=": "vim::AutoIndent",
316      "!": "vim::ShellCommand",
317      "i": ["vim::PushObject", { "around": false }],
318      "a": ["vim::PushObject", { "around": true }],
319      "g shift-r": ["vim::Paste", { "preserve_clipboard": true }],
320      "g c": "vim::ToggleComments",
321      "g q": "vim::Rewrap",
322      "g w": "vim::Rewrap",
323      "g ?": "vim::ConvertToRot13",
324      // "g ?": "vim::ConvertToRot47",
325      "\"": "vim::PushRegister"
326    }
327  },
328  {
329    "context": "vim_mode == helix_select",
330    "bindings": {
331      "v": "vim::NormalBefore",
332      ";": "vim::HelixCollapseSelection",
333      "~": "vim::ChangeCase",
334      "ctrl-a": "vim::Increment",
335      "ctrl-x": "vim::Decrement",
336      "shift-j": "vim::JoinLines",
337      "i": "vim::InsertBefore",
338      "a": "vim::InsertAfter",
339      "p": "vim::Paste",
340      "u": "vim::Undo",
341      "r": "vim::PushReplace",
342      "s": "vim::Substitute",
343      "ctrl-pageup": "pane::ActivatePreviousItem",
344      "ctrl-pagedown": "pane::ActivateNextItem",
345      ".": "vim::Repeat",
346      "alt-.": "vim::RepeatFind"
347    }
348  },
349  {
350    "context": "vim_mode == insert",
351    "bindings": {
352      "ctrl-c": "vim::NormalBefore",
353      "ctrl-[": "vim::NormalBefore",
354      "escape": "vim::NormalBefore",
355      "ctrl-x": null,
356      "ctrl-x ctrl-o": "editor::ShowCompletions",
357      "ctrl-x ctrl-a": "assistant::InlineAssist", // zed specific
358      "ctrl-x ctrl-c": "editor::ShowEditPrediction", // zed specific
359      "ctrl-x ctrl-l": "editor::ToggleCodeActions", // zed specific
360      "ctrl-x ctrl-z": "editor::Cancel",
361      "ctrl-x ctrl-e": "vim::LineDown",
362      "ctrl-x ctrl-y": "vim::LineUp",
363      "ctrl-w": ["editor::DeleteToPreviousWordStart", { "ignore_newlines": false, "ignore_brackets": false }],
364      "ctrl-u": "editor::DeleteToBeginningOfLine",
365      "ctrl-t": "vim::Indent",
366      "ctrl-d": "vim::Outdent",
367      "ctrl-y": "vim::InsertFromAbove",
368      "ctrl-e": "vim::InsertFromBelow",
369      "ctrl-k": ["vim::PushDigraph", {}],
370      "ctrl-v": ["vim::PushLiteral", {}],
371      "ctrl-shift-v": "editor::Paste", // note: this is *very* similar to ctrl-v in vim, but ctrl-shift-v on linux is the typical shortcut for paste when ctrl-v is already in use.
372      "ctrl-q": ["vim::PushLiteral", {}],
373      "ctrl-shift-q": ["vim::PushLiteral", {}],
374      "ctrl-r": "vim::PushRegister",
375      "insert": "vim::ToggleReplace",
376      "ctrl-o": "vim::TemporaryNormal",
377      "ctrl-s": "editor::ShowSignatureHelp"
378    }
379  },
380  {
381    "context": "showing_completions",
382    "bindings": {
383      "ctrl-d": "vim::ScrollDown",
384      "ctrl-u": "vim::ScrollUp",
385      "ctrl-e": "vim::LineDown",
386      "ctrl-y": "vim::LineUp"
387    }
388  },
389  {
390    "context": "(vim_mode == normal || vim_mode == helix_normal) && !menu",
391    "bindings": {
392      "escape": "editor::Cancel",
393      "shift-d": "vim::DeleteToEndOfLine",
394      "shift-j": "vim::JoinLines",
395      "shift-y": "vim::YankLine",
396      "shift-i": "vim::InsertFirstNonWhitespace",
397      "shift-a": "vim::InsertEndOfLine",
398      "o": "vim::InsertLineBelow",
399      "shift-o": "vim::InsertLineAbove",
400      "~": "vim::ChangeCase",
401      "ctrl-a": "vim::Increment",
402      "ctrl-x": "vim::Decrement",
403      "p": "vim::Paste",
404      "shift-p": ["vim::Paste", { "before": true }],
405      "u": "vim::Undo",
406      "shift-u": "vim::UndoLastLine",
407      "r": "vim::PushReplace",
408      "s": "vim::Substitute",
409      "shift-s": "vim::SubstituteLine",
410      "\"": "vim::PushRegister",
411      "ctrl-pagedown": "pane::ActivateNextItem",
412      "ctrl-pageup": "pane::ActivatePreviousItem"
413    }
414  },
415  {
416    "context": "vim_mode == helix_normal && !menu",
417    "bindings": {
418      "i": "vim::HelixInsert",
419      "a": "vim::HelixAppend",
420      "ctrl-[": "editor::Cancel"
421    }
422  },
423  {
424    "context": "(vim_mode == helix_normal || vim_mode == helix_select) && !menu",
425    "bindings": {
426      ";": "vim::HelixCollapseSelection",
427      ":": "command_palette::Toggle",
428      "m": "vim::PushHelixMatch",
429      "s": "vim::HelixSelectRegex",
430      "]": ["vim::PushHelixNext", { "around": true }],
431      "[": ["vim::PushHelixPrevious", { "around": true }],
432      "left": "vim::WrappingLeft",
433      "right": "vim::WrappingRight",
434      "h": "vim::WrappingLeft",
435      "l": "vim::WrappingRight",
436      "y": "vim::HelixYank",
437      "p": "vim::HelixPaste",
438      "shift-p": ["vim::HelixPaste", { "before": true }],
439      "alt-;": "vim::OtherEnd",
440      "ctrl-r": "vim::Redo",
441      "f": ["vim::PushFindForward", { "before": false, "multiline": true }],
442      "t": ["vim::PushFindForward", { "before": true, "multiline": true }],
443      "shift-f": ["vim::PushFindBackward", { "after": false, "multiline": true }],
444      "shift-t": ["vim::PushFindBackward", { "after": true, "multiline": true }],
445      ">": "vim::Indent",
446      "<": "vim::Outdent",
447      "=": "vim::AutoIndent",
448      "`": "vim::ConvertToLowerCase",
449      "alt-`": "vim::ConvertToUpperCase",
450      "g q": "vim::PushRewrap",
451      "g w": "vim::PushRewrap",
452      "insert": "vim::InsertBefore",
453      "alt-.": "vim::RepeatFind",
454      "alt-s": ["editor::SplitSelectionIntoLines", { "keep_selections": true }],
455      // Goto mode
456      "g n": "pane::ActivateNextItem",
457      "g p": "pane::ActivatePreviousItem",
458      // "tab": "pane::ActivateNextItem",
459      // "shift-tab": "pane::ActivatePrevItem",
460      "shift-h": "pane::ActivatePreviousItem",
461      "shift-l": "pane::ActivateNextItem",
462      "g l": "vim::EndOfLine",
463      "g h": "vim::StartOfLine",
464      "g s": "vim::FirstNonWhitespace", // "g s" default behavior is "space s"
465      "g e": "vim::EndOfDocument",
466      "g .": "vim::HelixGotoLastModification", // go to last modification
467      "g r": "editor::FindAllReferences", // zed specific
468      "g t": "vim::WindowTop",
469      "g c": "vim::WindowMiddle",
470      "g b": "vim::WindowBottom",
471
472      "shift-r": "editor::Paste",
473      "x": "vim::HelixSelectLine",
474      "shift-x": "editor::SelectLine",
475      "%": "editor::SelectAll",
476      // Window mode
477      "space w h": "workspace::ActivatePaneLeft",
478      "space w l": "workspace::ActivatePaneRight",
479      "space w k": "workspace::ActivatePaneUp",
480      "space w j": "workspace::ActivatePaneDown",
481      "space w q": "pane::CloseActiveItem",
482      "space w s": "pane::SplitRight",
483      "space w r": "pane::SplitRight",
484      "space w v": "pane::SplitDown",
485      "space w d": "pane::SplitDown",
486      // Space mode
487      "space f": "file_finder::Toggle",
488      "space k": "editor::Hover",
489      "space s": "outline::Toggle",
490      "space shift-s": "project_symbols::Toggle",
491      "space d": "editor::GoToDiagnostic",
492      "space r": "editor::Rename",
493      "space a": "editor::ToggleCodeActions",
494      "space h": "editor::SelectAllMatches",
495      "space c": "editor::ToggleComments",
496      "space y": "editor::Copy",
497      "space p": "editor::Paste",
498      "shift-u": "editor::Redo",
499      "ctrl-c": "editor::ToggleComments",
500      "d": "vim::HelixDelete",
501      "c": "vim::Substitute",
502      "shift-c": "editor::AddSelectionBelow",
503      "alt-shift-c": "editor::AddSelectionAbove"
504    }
505  },
506  {
507    "context": "vim_mode == insert && !(showing_code_actions || showing_completions)",
508    "bindings": {
509      "ctrl-p": "editor::ShowWordCompletions",
510      "ctrl-n": "editor::ShowWordCompletions"
511    }
512  },
513  {
514    "context": "(vim_mode == insert || vim_mode == normal) && showing_signature_help && !showing_completions",
515    "bindings": {
516      "ctrl-p": "editor::SignatureHelpPrevious",
517      "ctrl-n": "editor::SignatureHelpNext"
518    }
519  },
520  {
521    "context": "vim_mode == replace",
522    "bindings": {
523      "ctrl-c": "vim::NormalBefore",
524      "ctrl-[": "vim::NormalBefore",
525      "escape": "vim::NormalBefore",
526      "ctrl-k": ["vim::PushDigraph", {}],
527      "ctrl-v": ["vim::PushLiteral", {}],
528      "ctrl-shift-v": "editor::Paste", // note: this is *very* similar to ctrl-v in vim, but ctrl-shift-v on linux is the typical shortcut for paste when ctrl-v is already in use.
529      "ctrl-q": ["vim::PushLiteral", {}],
530      "ctrl-shift-q": ["vim::PushLiteral", {}],
531      "backspace": "vim::UndoReplace",
532      "tab": "vim::Tab",
533      "enter": "vim::Enter",
534      "insert": "vim::InsertBefore"
535    }
536  },
537  {
538    "context": "vim_mode == waiting",
539    "bindings": {
540      "tab": "vim::Tab",
541      "enter": "vim::Enter",
542      "ctrl-c": "vim::ClearOperators",
543      "ctrl-[": "vim::ClearOperators",
544      "escape": "vim::ClearOperators",
545      "ctrl-k": ["vim::PushDigraph", {}],
546      "ctrl-v": ["vim::PushLiteral", {}],
547      "ctrl-q": ["vim::PushLiteral", {}]
548    }
549  },
550  {
551    "context": "Editor && vim_mode == waiting && (vim_operator == ys || vim_operator == cs)",
552    "bindings": {
553      "escape": "vim::SwitchToNormalMode"
554    }
555  },
556  {
557    "context": "vim_mode == operator",
558    "bindings": {
559      "ctrl-c": "vim::ClearOperators",
560      "ctrl-[": "vim::ClearOperators",
561      "escape": "vim::ClearOperators",
562      "g c": "vim::Comment"
563    }
564  },
565  {
566    "context": "vim_operator == a || vim_operator == i || vim_operator == cs || vim_operator == helix_next || vim_operator == helix_previous",
567    "bindings": {
568      "w": "vim::Word",
569      "shift-w": ["vim::Word", { "ignore_punctuation": true }],
570      // Subword TextObject
571      // "w": "vim::Subword",
572      // "shift-w": ["vim::Subword", { "ignore_punctuation": true }],
573      "t": "vim::Tag",
574      "s": "vim::Sentence",
575      "p": "vim::Paragraph",
576      "'": "vim::Quotes",
577      "`": "vim::BackQuotes",
578      "\"": "vim::DoubleQuotes",
579      // "q": "vim::AnyQuotes",
580      "q": "vim::MiniQuotes",
581      "|": "vim::VerticalBars",
582      "(": "vim::Parentheses",
583      ")": "vim::Parentheses",
584      "b": "vim::Parentheses",
585      // "b": "vim::AnyBrackets",
586      // "b": "vim::MiniBrackets",
587      "[": "vim::SquareBrackets",
588      "]": "vim::SquareBrackets",
589      "r": "vim::SquareBrackets",
590      "{": "vim::CurlyBrackets",
591      "}": "vim::CurlyBrackets",
592      "shift-b": "vim::CurlyBrackets",
593      "<": "vim::AngleBrackets",
594      ">": "vim::AngleBrackets",
595      "a": "vim::Argument",
596      "i": "vim::IndentObj",
597      "shift-i": ["vim::IndentObj", { "include_below": true }],
598      "f": "vim::Method",
599      "c": "vim::Class",
600      "e": "vim::EntireFile"
601    }
602  },
603  {
604    "context": "vim_operator == helix_m",
605    "bindings": {
606      "m": "vim::Matching"
607    }
608  },
609  {
610    "context": "vim_operator == helix_next",
611    "bindings": {
612      "z": "vim::NextSectionStart",
613      "shift-z": "vim::NextSectionEnd",
614      "*": "vim::NextComment",
615      "/": "vim::NextComment",
616      "-": "vim::NextLesserIndent",
617      "+": "vim::NextGreaterIndent",
618      "=": "vim::NextSameIndent",
619      "b": "pane::ActivateNextItem",
620      "shift-b": "pane::ActivateLastItem",
621      "x": "editor::SelectSmallerSyntaxNode",
622      "d": "editor::GoToDiagnostic",
623      "c": "editor::GoToHunk",
624      "space": "vim::InsertEmptyLineBelow"
625    }
626  },
627  {
628    "context": "vim_operator == helix_previous",
629    "bindings": {
630      "z": "vim::PreviousSectionStart",
631      "shift-z": "vim::PreviousSectionEnd",
632      "*": "vim::PreviousComment",
633      "/": "vim::PreviousComment",
634      "-": "vim::PreviousLesserIndent",
635      "+": "vim::PreviousGreaterIndent",
636      "=": "vim::PreviousSameIndent",
637      "b": "pane::ActivatePreviousItem",
638      "shift-b": ["pane::ActivateItem", 0],
639      "x": "editor::SelectLargerSyntaxNode",
640      "d": "editor::GoToPreviousDiagnostic",
641      "c": "editor::GoToPreviousHunk",
642      "space": "vim::InsertEmptyLineAbove"
643    }
644  },
645  {
646    "context": "vim_operator == c",
647    "bindings": {
648      "c": "vim::CurrentLine",
649      "x": "vim::Exchange",
650      "d": "editor::Rename", // zed specific
651      "s": ["vim::PushChangeSurrounds", {}]
652    }
653  },
654  {
655    "context": "vim_operator == d",
656    "bindings": {
657      "d": "vim::CurrentLine",
658      "s": "vim::PushDeleteSurrounds",
659      "v": "vim::PushForcedMotion", // "d v"
660      "o": "editor::ToggleSelectedDiffHunks", // "d o"
661      "shift-o": "git::ToggleStaged",
662      "p": "git::Restore", // "d p"
663      "u": "git::StageAndNext", // "d u"
664      "shift-u": "git::UnstageAndNext" // "d shift-u"
665    }
666  },
667  {
668    "context": "vim_operator == gu",
669    "bindings": {
670      "g u": "vim::CurrentLine",
671      "u": "vim::CurrentLine"
672    }
673  },
674  {
675    "context": "vim_operator == gU",
676    "bindings": {
677      "g shift-u": "vim::CurrentLine",
678      "shift-u": "vim::CurrentLine"
679    }
680  },
681  {
682    "context": "vim_operator == g~",
683    "bindings": {
684      "g ~": "vim::CurrentLine",
685      "~": "vim::CurrentLine"
686    }
687  },
688  {
689    "context": "vim_operator == g?",
690    "bindings": {
691      "g ?": "vim::CurrentLine",
692      "?": "vim::CurrentLine"
693    }
694  },
695  {
696    "context": "vim_operator == gq",
697    "bindings": {
698      "g q": "vim::CurrentLine",
699      "q": "vim::CurrentLine",
700      "g w": "vim::CurrentLine",
701      "w": "vim::CurrentLine"
702    }
703  },
704  {
705    "context": "vim_operator == y",
706    "bindings": {
707      "y": "vim::CurrentLine",
708      "v": "vim::PushForcedMotion",
709      "s": ["vim::PushAddSurrounds", {}]
710    }
711  },
712  {
713    "context": "vim_operator == ys",
714    "bindings": {
715      "s": "vim::CurrentLine"
716    }
717  },
718  {
719    "context": "vim_operator == >",
720    "bindings": {
721      ">": "vim::CurrentLine"
722    }
723  },
724  {
725    "context": "vim_operator == <",
726    "bindings": {
727      "<": "vim::CurrentLine"
728    }
729  },
730  {
731    "context": "vim_operator == eq",
732    "bindings": {
733      "=": "vim::CurrentLine"
734    }
735  },
736  {
737    "context": "vim_operator == sh",
738    "bindings": {
739      "!": "vim::CurrentLine"
740    }
741  },
742  {
743    "context": "vim_operator == gc",
744    "bindings": {
745      "c": "vim::CurrentLine"
746    }
747  },
748  {
749    "context": "vim_operator == gR",
750    "bindings": {
751      "r": "vim::CurrentLine",
752      "shift-r": "vim::CurrentLine"
753    }
754  },
755  {
756    "context": "vim_operator == cx",
757    "bindings": {
758      "x": "vim::CurrentLine",
759      "c": "vim::ClearExchange"
760    }
761  },
762  {
763    "context": "vim_mode == literal",
764    "bindings": {
765      "ctrl-@": ["vim::Literal", ["ctrl-@", "\u0000"]],
766      "ctrl-a": ["vim::Literal", ["ctrl-a", "\u0001"]],
767      "ctrl-b": ["vim::Literal", ["ctrl-b", "\u0002"]],
768      "ctrl-c": ["vim::Literal", ["ctrl-c", "\u0003"]],
769      "ctrl-d": ["vim::Literal", ["ctrl-d", "\u0004"]],
770      "ctrl-e": ["vim::Literal", ["ctrl-e", "\u0005"]],
771      "ctrl-f": ["vim::Literal", ["ctrl-f", "\u0006"]],
772      "ctrl-g": ["vim::Literal", ["ctrl-g", "\u0007"]],
773      "ctrl-h": ["vim::Literal", ["ctrl-h", "\u0008"]],
774      "ctrl-i": ["vim::Literal", ["ctrl-i", "\u0009"]],
775      "ctrl-j": ["vim::Literal", ["ctrl-j", "\u000A"]],
776      "ctrl-k": ["vim::Literal", ["ctrl-k", "\u000B"]],
777      "ctrl-l": ["vim::Literal", ["ctrl-l", "\u000C"]],
778      "ctrl-m": ["vim::Literal", ["ctrl-m", "\u000D"]],
779      "ctrl-n": ["vim::Literal", ["ctrl-n", "\u000E"]],
780      "ctrl-o": ["vim::Literal", ["ctrl-o", "\u000F"]],
781      "ctrl-p": ["vim::Literal", ["ctrl-p", "\u0010"]],
782      "ctrl-q": ["vim::Literal", ["ctrl-q", "\u0011"]],
783      "ctrl-r": ["vim::Literal", ["ctrl-r", "\u0012"]],
784      "ctrl-s": ["vim::Literal", ["ctrl-s", "\u0013"]],
785      "ctrl-t": ["vim::Literal", ["ctrl-t", "\u0014"]],
786      "ctrl-u": ["vim::Literal", ["ctrl-u", "\u0015"]],
787      "ctrl-v": ["vim::Literal", ["ctrl-v", "\u0016"]],
788      "ctrl-w": ["vim::Literal", ["ctrl-w", "\u0017"]],
789      "ctrl-x": ["vim::Literal", ["ctrl-x", "\u0018"]],
790      "ctrl-y": ["vim::Literal", ["ctrl-y", "\u0019"]],
791      "ctrl-z": ["vim::Literal", ["ctrl-z", "\u001A"]],
792      "ctrl-[": ["vim::Literal", ["ctrl-[", "\u001B"]],
793      "ctrl-\\": ["vim::Literal", ["ctrl-\\", "\u001C"]],
794      "ctrl-]": ["vim::Literal", ["ctrl-]", "\u001D"]],
795      "ctrl-^": ["vim::Literal", ["ctrl-^", "\u001E"]],
796      "ctrl-_": ["vim::Literal", ["ctrl-_", "\u001F"]],
797      "escape": ["vim::Literal", ["escape", "\u001B"]],
798      "enter": ["vim::Literal", ["enter", "\u000D"]],
799      "tab": ["vim::Literal", ["tab", "\u0009"]],
800      // zed extensions:
801      "backspace": ["vim::Literal", ["backspace", "\u0008"]],
802      "delete": ["vim::Literal", ["delete", "\u007F"]]
803    }
804  },
805  {
806    "context": "BufferSearchBar && !in_replace",
807    "bindings": {
808      "enter": "vim::SearchSubmit",
809      "escape": "buffer_search::Dismiss"
810    }
811  },
812  {
813    "context": "VimControl || !Editor && !Terminal",
814    "bindings": {
815      // window related commands (ctrl-w X)
816      "ctrl-w": null,
817      "ctrl-w left": "workspace::ActivatePaneLeft",
818      "ctrl-w right": "workspace::ActivatePaneRight",
819      "ctrl-w up": "workspace::ActivatePaneUp",
820      "ctrl-w down": "workspace::ActivatePaneDown",
821      "ctrl-w ctrl-h": "workspace::ActivatePaneLeft",
822      "ctrl-w ctrl-l": "workspace::ActivatePaneRight",
823      "ctrl-w ctrl-k": "workspace::ActivatePaneUp",
824      "ctrl-w ctrl-j": "workspace::ActivatePaneDown",
825      "ctrl-w h": "workspace::ActivatePaneLeft",
826      "ctrl-w l": "workspace::ActivatePaneRight",
827      "ctrl-w k": "workspace::ActivatePaneUp",
828      "ctrl-w j": "workspace::ActivatePaneDown",
829      "ctrl-w shift-left": "workspace::SwapPaneLeft",
830      "ctrl-w shift-right": "workspace::SwapPaneRight",
831      "ctrl-w shift-up": "workspace::SwapPaneUp",
832      "ctrl-w shift-down": "workspace::SwapPaneDown",
833      "ctrl-w shift-h": "workspace::SwapPaneLeft",
834      "ctrl-w shift-l": "workspace::SwapPaneRight",
835      "ctrl-w shift-k": "workspace::SwapPaneUp",
836      "ctrl-w shift-j": "workspace::SwapPaneDown",
837      "ctrl-w >": "vim::ResizePaneRight",
838      "ctrl-w <": "vim::ResizePaneLeft",
839      "ctrl-w -": "vim::ResizePaneDown",
840      "ctrl-w +": "vim::ResizePaneUp",
841      "ctrl-w _": "vim::MaximizePane",
842      "ctrl-w =": "vim::ResetPaneSizes",
843      "ctrl-w g t": "pane::ActivateNextItem",
844      "ctrl-w ctrl-g t": "pane::ActivateNextItem",
845      "ctrl-w g shift-t": "pane::ActivatePreviousItem",
846      "ctrl-w ctrl-g shift-t": "pane::ActivatePreviousItem",
847      "ctrl-w w": "workspace::ActivateNextPane",
848      "ctrl-w ctrl-w": "workspace::ActivateNextPane",
849      "ctrl-w p": "workspace::ActivatePreviousPane",
850      "ctrl-w ctrl-p": "workspace::ActivatePreviousPane",
851      "ctrl-w shift-w": "workspace::ActivatePreviousPane",
852      "ctrl-w ctrl-shift-w": "workspace::ActivatePreviousPane",
853      "ctrl-w ctrl-v": "pane::SplitVertical",
854      "ctrl-w v": "pane::SplitVertical",
855      "ctrl-w shift-s": "pane::SplitHorizontal",
856      "ctrl-w ctrl-s": "pane::SplitHorizontal",
857      "ctrl-w s": "pane::SplitHorizontal",
858      "ctrl-w ctrl-c": "pane::CloseActiveItem",
859      "ctrl-w c": "pane::CloseActiveItem",
860      "ctrl-w ctrl-q": "pane::CloseActiveItem",
861      "ctrl-w q": "pane::CloseActiveItem",
862      "ctrl-w ctrl-a": "pane::CloseAllItems",
863      "ctrl-w a": "pane::CloseAllItems",
864      "ctrl-w ctrl-o": "workspace::CloseInactiveTabsAndPanes",
865      "ctrl-w o": "workspace::CloseInactiveTabsAndPanes",
866      "ctrl-w ctrl-n": "workspace::NewFileSplitHorizontal",
867      "ctrl-w n": "workspace::NewFileSplitHorizontal"
868    }
869  },
870  {
871    "context": "!Editor && !Terminal",
872    "bindings": {
873      ":": "command_palette::Toggle",
874      "g /": "pane::DeploySearch"
875    }
876  },
877  {
878    // netrw compatibility
879    "context": "ProjectPanel && not_editing",
880    "bindings": {
881      ":": "command_palette::Toggle",
882      "%": "project_panel::NewFile",
883      "/": "project_panel::NewSearchInDirectory",
884      "d": "project_panel::NewDirectory",
885      "enter": "project_panel::OpenPermanent",
886      "escape": "project_panel::ToggleFocus",
887      "h": "project_panel::CollapseSelectedEntry",
888      "j": "menu::SelectNext",
889      "k": "menu::SelectPrevious",
890      "l": "project_panel::ExpandSelectedEntry",
891      "shift-d": "project_panel::Delete",
892      "shift-r": "project_panel::Rename",
893      "t": "project_panel::OpenPermanent",
894      "v": "project_panel::OpenSplitVertical",
895      "o": "project_panel::OpenSplitHorizontal",
896      "p": "project_panel::Open",
897      "x": "project_panel::RevealInFileManager",
898      "s": "workspace::OpenWithSystem",
899      "z d": "project_panel::CompareMarkedFiles",
900      "] c": "project_panel::SelectNextGitEntry",
901      "[ c": "project_panel::SelectPrevGitEntry",
902      "] d": "project_panel::SelectNextDiagnostic",
903      "[ d": "project_panel::SelectPrevDiagnostic",
904      "}": "project_panel::SelectNextDirectory",
905      "{": "project_panel::SelectPrevDirectory",
906      "shift-g": "menu::SelectLast",
907      "g g": "menu::SelectFirst",
908      "-": "project_panel::SelectParent"
909    }
910  },
911  {
912    "context": "OutlinePanel && not_editing",
913    "bindings": {
914      "j": "menu::SelectNext",
915      "k": "menu::SelectPrevious",
916      "shift-g": "menu::SelectLast",
917      "g g": "menu::SelectFirst"
918    }
919  },
920  {
921    "context": "GitPanel && ChangesList",
922    "use_key_equivalents": true,
923    "bindings": {
924      "k": "menu::SelectPrevious",
925      "j": "menu::SelectNext",
926      "g g": "menu::SelectFirst",
927      "shift-g": "menu::SelectLast",
928      "g f": "menu::Confirm",
929      "i": "git_panel::FocusEditor",
930      "x": "git::ToggleStaged",
931      "shift-x": "git::StageAll",
932      "g x": "git::StageRange",
933      "shift-u": "git::UnstageAll"
934    }
935  },
936  {
937    "context": "Editor && mode == auto_height && VimControl",
938    "bindings": {
939      // TODO: Implement search
940      "/": null,
941      "?": null,
942      "#": null,
943      "*": null,
944      "n": null,
945      "shift-n": null
946    }
947  },
948  {
949    "context": "Picker > Editor",
950    "bindings": {
951      "ctrl-h": "editor::Backspace",
952      "ctrl-u": "editor::DeleteToBeginningOfLine",
953      "ctrl-w": "editor::DeleteToPreviousWordStart"
954    }
955  },
956  {
957    "context": "GitCommit > Editor && VimControl && vim_mode == normal",
958    "bindings": {
959      "ctrl-c": "menu::Cancel",
960      "escape": "menu::Cancel"
961    }
962  },
963  {
964    "context": "Editor && edit_prediction",
965    "bindings": {
966      // This is identical to the binding in the base keymap, but the vim bindings above to
967      // "vim::Tab" shadow it, so it needs to be bound again.
968      "tab": "editor::AcceptEditPrediction"
969    }
970  },
971  {
972    "context": "MessageEditor > Editor && VimControl",
973    "bindings": {
974      "enter": "agent::Chat"
975    }
976  },
977  {
978    "context": "os != macos && Editor && edit_prediction_conflict",
979    "bindings": {
980      // alt-l is provided as an alternative to tab/alt-tab. and will be displayed in the UI. This
981      // is because alt-tab may not be available, as it is often used for window switching on Linux
982      // and Windows.
983      "alt-l": "editor::AcceptEditPrediction"
984    }
985  }
986]