Skip to content

Instantly share code, notes, and snippets.

@ryanwinchester
Created April 20, 2024 12:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanwinchester/71421ce0a984ae7b72e8b8b39ac88627 to your computer and use it in GitHub Desktop.
Save ryanwinchester/71421ce0a984ae7b72e8b8b39ac88627 to your computer and use it in GitHub Desktop.
Zed keymap working on my vim stuff
[
// -----------------------------------------------------------------------
// Vim keybindings
// -----------------------------------------------------------------------
{
// NORMAL and VISUAL modes
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu",
"bindings": {
// Tab things. Almost as good as harpoon.
"space 1": ["pane::ActivateItem", 0],
"space 2": ["pane::ActivateItem", 1],
"space 3": ["pane::ActivateItem", 2],
"space 4": ["pane::ActivateItem", 3],
"space 5": ["pane::ActivateItem", 4],
"space 6": ["pane::ActivateItem", 5],
"space 7": ["pane::ActivateItem", 6],
"space 8": ["pane::ActivateItem", 7],
"space 9": ["pane::ActivateItem", 8],
"space 0": "pane::ActivateLastItem",
"] b": "pane::ActivateNextItem",
"[ b": "pane::ActivatePrevItem",
"space b d": "pane::CloseActiveItem",
// File explorer...
"space e": "workspace::ToggleLeftDock",
// "Telescope" things.
"space space": "file_finder::Toggle",
// Indenting/Unindenting.
"tab": "editor::Indent",
"shift-tab": "editor::TabPrev"
}
},
// NORMAL mode
{
"context": "Editor && vim_mode == normal && !VimWaiting && !menu",
"bindings": {
// e.g.
// "down": ["workspace::SendKeystrokes", "4 j"]
// "up": ["workspace::SendKeystrokes", "4 k"]
}
},
// VISUAL, VISUAL LINE, and VISUAL BLOCK modes
{
"context": "Editor && vim_mode == visual && !VimWaiting && !menu",
"bindings": {
// This is coming in the next release `0.132.0`.
"g c": "editor::ToggleComments"
}
},
// INSERT mode
{
"context": "Editor && vim_mode == insert && !menu",
"bindings": {
// e.g.
// "j j": "vim::NormalBefore" // remap jj in insert mode to escape.
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment