My Zed Vim Keybindings

I haven't been able to use Zed very seriously since i use Vim keybindings and the page up and down would pollute the jumplist but since that has been fixed I've been able to use Zed much more and it's a pretty decent editor.
My Zed Vim Keybindings

My Zed Vim Keybindings

I haven’t been able to use Zed very seriously since i use Vim keybindings and the page up and down would pollute the jumplist but since that has been fixed I’ve been able to use Zed much more and it’s a pretty decent editor. Anyway here are some keybindings I find useful:

keymap.json :

[
  {
    "bindings": {
      "ctrl-j": "menu::SelectNext",
      "ctrl-k": "menu::SelectPrevious"
    }
  },
  {
    "context": "ProjectPanel && not_editing",
    "bindings": {
      "l": "project_panel::Open",
      "shift-o": "project_panel::RevealInFileManager",
      "r": "project_panel::Rename",
      "x": "project_panel::Cut",
      "y": "project_panel::Copy",
      "p": "project_panel::Paste",
      "d": "project_panel::Trash",
      "ctrl-j": "project_panel::SelectNextDirectory",
      "ctrl-k": "project_panel::SelectPrevDirectory",
      "shift-d": ["project_panel::Trash", { "skip_prompt": true }],
      "space e": "workspace::ToggleLeftDock",
      "a": "project_panel::NewFile",
      "shift-a": "project_panel::NewDirectory",
      "shift-y": "workspace::CopyRelativePath",
      "g y": "workspace::CopyPath"
    }
  },
  {
    "context": "Editor && (showing_code_actions || showing_completions)",
    "bindings": {
      "ctrl-j": "editor::ContextMenuNext",
      "ctrl-k": "editor::ContextMenuPrevious"
    }
  },
  {
    "context": "Workspace",
    "bindings": {
      "cmd-k": [
        "projects::OpenRecent",
        {
          "create_new_window": false
        }
      ]
    }
  },
  {
    "context": "Terminal",
    "bindings": {
      "ctrl-shift-l": "pane::ActivateNextItem",
      "ctrl-shift-h": "pane::ActivatePreviousItem"
    }
  },

  {
    "context": "TabSwitcher",
    "bindings": {
      "k": "menu::SelectPrevious",
      "j": "menu::SelectNext",
      "l": "menu::Confirm",
      "x": "tab_switcher::CloseSelectedItem",
      "d": "tab_switcher::CloseSelectedItem",
      "q": "tab_switcher::CloseSelectedItem"
    }
  },
  {
    "context": "Editor && vim_mode==normal && !menu",
    "bindings": {
      "alt-h": "workspace::ActivatePaneLeft",
      "alt-j": "workspace::ActivatePaneDown",
      "alt-k": "workspace::ActivatePaneUp",
      "alt-l": "workspace::ActivatePaneRight",
      "ctrl-k": ["workspace::SendKeystrokes", "ctrl-u z z"],
      "ctrl-j": ["workspace::SendKeystrokes", "ctrl-d z z"]
    }
  },
  {
    "context": "Dock",
    "bindings": {
      "alt-h": "workspace::ActivatePaneLeft",
      "alt-l": "workspace::ActivatePaneRight",
      "alt-k": "workspace::ActivatePaneUp",
      "alt-j": "workspace::ActivatePaneDown"
    }
  },
  {
    "context": "Editor && VimControl && vim_operator == none && !VimWaiting",
    "bindings": {
      "space e": "workspace::ToggleLeftDock",
      // "space t": "workspace::ToggleBottomDock",
      // "space t": "workspace::Term",
      "space c": [
        "editor::ToggleComments",
        {
          "advance_downwards": false
        }
      ],
      "space /": ["workspace::SendKeystrokes", "space c escape"]
    }
  },

  {
    // Put key bindings here if you want them to work in normal & visual mode.
    "context": "VimControl && !VimWaiting && !menu",
    "bindings": {
      // lsp
      "space l f": "editor::Format",
      "space l i": "editor::ToggleInlayHints",
      "space l d": "diagnostics::Deploy",
      "space l s": "outline::Toggle",

      "space z": "workspace::ToggleCenteredLayout",
      "space s": "pane::SplitRight",
      "j": ["vim::Down", { "display_lines": true }],
      "k": ["vim::Up", { "display_lines": true }],

      // Buffers
      "space b b": "tab_switcher::Toggle",

      // git
      "space g g": "git_panel::ToggleFocus",
      "space g l": "editor::ToggleGitBlameInline",

      "n": ["workspace::SendKeystrokes", "n z z"],
      "shift-n": ["workspace::SendKeystrokes", "shift-n z z"],
      "*": ["workspace::SendKeystrokes", "* z z"],
      "#": ["workspace::SendKeystrokes", "# z z"],

      // utility
      "space w": "editor::ToggleSoftWrap",
      "left": "vim::WrappingLeft",
      "right": "vim::WrappingRight",
      "h": "vim::WrappingLeft",
      "l": "vim::WrappingRight",

      // find
      "space f f": "file_finder::Toggle",
      "space f t": "pane::DeploySearch",
      "space p": [
        "projects::OpenRecent",
        {
          "create_new_window": false
        }
      ]
    }
  },
  {
    "context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
    "bindings": {
      "Q": "pane::CloseActiveItem",
      "space q": "pane::CloseActiveItem"
    }
  },
  {
    "context": "Editor && vim_mode == visual && !VimWaiting && !VimObject",
    "bindings": {
      "p": ["vim::Paste", { "preserve_clipboard": true }],
      "shift-p": ["vim::Paste", { "preserve_clipboard": true }],
      "<": ["workspace::SendKeystrokes", "< g v"],
      ">": ["workspace::SendKeystrokes", "> g v"]
    }
  },
  {
    "context": "vim_mode == normal && !menu",
    "bindings": {
      "shift-y": ["workspace::SendKeystrokes", "y $"] // Use neovim's yank behavior: yank to end of line.
    }
  },
  {
    "context": "vim_mode == insert",
    "bindings": {
      "ctrl-l": "editor::AcceptEditPrediction"
      // "j k": "vim::NormalBefore" // In insert mode, make jk escape to normal mode.
    }
  },
  {
    "context": "vim_mode == normal || vim_mode == visual",
    "bindings": {
      "s": "vim::PushSneak",
      "shift-s": "vim::PushSneakBackward"
    }
  },
  {
    "context": "VimControl && !menu && vim_mode != operator",
    "bindings": {
      "w": "vim::NextSubwordStart",
      "b": "vim::PreviousSubwordStart",
      "e": "vim::NextSubwordEnd",
      "g e": "vim::PreviousSubwordEnd"
    }
  },
  {
    "context": "EmptyPane || SharedScreen",
    "bindings": {
      // put key-bindings here (in addition to above) if you want them to
      // work when no editor exists
      "space p": [
        "projects::OpenRecent",
        {
          "create_new_window": false
        }
      ],
      "space f f": "file_finder::Toggle",
      "space f t": "pane::DeploySearch"
    }
  }
]

Loading comments…