Skip to content

Instantly share code, notes, and snippets.

@claytonchew
Created May 2, 2026 09:47
Show Gist options
  • Select an option

  • Save claytonchew/2517f6bcdd5a1cb4fb6b598938f46b78 to your computer and use it in GitHub Desktop.

Select an option

Save claytonchew/2517f6bcdd5a1cb4fb6b598938f46b78 to your computer and use it in GitHub Desktop.
Zed keymap.json coming from neovim user
[
// =========================
// GLOBAL KEYBINDINGS
// =========================
{
"bindings": {
// pane navigation
"ctrl-h": "workspace::ActivatePaneLeft",
"ctrl-l": "workspace::ActivatePaneRight",
"ctrl-k": "workspace::ActivatePaneUp",
"ctrl-j": "workspace::ActivatePaneDown",
// toggle terminal
"ctrl-\\": "workspace::ToggleBottomDock",
},
},
// =========================
// EDITOR KEYBINDINGS
// =========================
{
"context": "Editor && VimControl",
"bindings": {
"ctrl-c": ["workspace::SendKeystrokes", "escape"],
},
},
{
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
// navigate wrapped lines
"j": ["vim::Down", { "display_lines": true }],
"k": ["vim::Up", { "display_lines": true }],
// save file
"ctrl-s": "workspace::Save",
"ctrl-shift-s": "workspace::SaveWithoutFormat",
// split pane
"space |": "pane::SplitRight",
"space _": "pane::SplitDown",
"space x w": "pane::CloseActiveItem",
// LSP related
"shift-k": "editor::Hover",
"space f": "editor::Format",
"space c a": "editor::ToggleCodeActions",
"space r n": "editor::Rename",
"g r": "editor::FindAllReferences",
"] d": "editor::GoToDiagnostic",
"[ d": "editor::GoToPreviousDiagnostic",
// git hunk navigation
"] h": "editor::GoToHunk",
"[ h": "editor::GoToPreviousHunk",
"space g s": "git::ToggleStaged",
"space g d": "git::Diff",
"space g r": "git::Restore",
// left dock
"space e": "pane::RevealInProjectPanel",
"\\": "pane::RevealInProjectPanel",
"space g p": "git_panel::ToggleFocus",
// lazyGit
"space g g": [
"task::Spawn",
{
"task_name": "lazygit",
"reveal_target": "center",
},
],
// github dash
"space g h": [
"task::Spawn",
{
"task_name": "dash",
"reveal_target": "center",
},
],
// move between tabs
"space o": "tab_switcher::Toggle",
"shift-h": "pane::ActivatePreviousItem",
"shift-l": "pane::ActivateNextItem",
"shift-q": "pane::CloseActiveItem",
// AI related
"space a a": "agent::ToggleFocus",
"space a i": "assistant::InlineAssist",
// disable default inline assist keybinding
"ctrl-enter": null,
// searches
"space s f": "file_finder::Toggle",
"space s g": "pane::DeploySearch",
"space space": "outline::Toggle",
"space s s": "project_symbols::Toggle",
// open recent project
"space s p": [
"projects::OpenRecent",
{
"create_new_window": false,
},
],
// auto center on scrolls
"ctrl-shift-u": "vim::ScrollUp",
"ctrl-shift-d": "vim::ScrollDown",
"ctrl-u": ["workspace::SendKeystrokes", "ctrl-shift-u z z"],
"ctrl-d": ["workspace::SendKeystrokes", "ctrl-shift-d z z"],
"n": ["workspace::SendKeystrokes", "n z z"],
"shift-n": ["workspace::SendKeystrokes", "shift-n z z"],
"shift-g": ["workspace::SendKeystrokes", "shift-g z z"],
},
},
// disable default ctrl+enter
{
"context": "!ContextEditor > (Editor && mode == full)",
"bindings": {
"ctrl-enter": "editor::AcceptEditPrediction", // this disable inline assist and overrides with accept edit prediction (copilot)
},
},
// refactor rename
{
"context": "(Editor && mode == full) && renaming",
"bindings": {
"enter": "editor::ConfirmRename",
"ctrl+enter": "editor::ConfirmRename",
},
},
// =========================
// EMPTY PANE / SHARED SCREEN / KEY CONTEXT VIEW
// =========================
{
"context": "SharedScreen || KeyContextView || MarkdownPreview",
"bindings": {
"shift-q": "pane::CloseActiveItem",
},
},
// enable essentials on empty/shared/context view
{
"context": "EmptyPane || SharedScreen || KeyContextView",
"bindings": {
// searches
"space s f": "file_finder::Toggle",
"space s g": "pane::DeploySearch",
// Open recent project
"space s p": [
"projects::OpenRecent",
{
"create_new_window": false,
},
],
// Tabs
"space o": "tab_switcher::Toggle",
"shift-h": "pane::ActivatePreviousItem",
"shift-l": "pane::ActivateNextItem",
// "shift-q": "pane::CloseActiveItem",
// Left Dock
"space e": "project_panel::ToggleFocus",
"\\": "project_panel::ToggleFocus",
"space g p": "git_panel::ToggleFocus",
"space g g": [
"task::Spawn",
{
"task_name": "lazygit",
"reveal_target": "center",
},
],
},
},
// =========================
// PANEL KEYBINDINGS
// =========================
// agent panel toggle
{
"context": "AgentPanel > Markdown",
"bindings": {
"space a a": "workspace::ToggleRightDock",
},
},
{
"context": "( AgentPanel > MessageEditor && MessageEditor > Editor ) || AgentPanel",
"bindings": {
"escape": "workspace::ToggleRightDock",
},
},
// close inline assist on ctrl+c
{
"context": "InlineAssistEditor",
"bindings": {
"ctrl-c": "editor::Cancel",
},
},
// Project Panel
{
"context": "ProjectPanel && not_editing",
"bindings": {
"a": "project_panel::NewFile",
"A": "project_panel::NewDirectory",
"r": "project_panel::Rename",
"d": "project_panel::Delete",
"x": "project_panel::Cut",
"c": "project_panel::Copy",
"p": "project_panel::Paste",
"z": "project_panel::CollapseSelectedEntry",
"Z": "project_panel::CollapseAllEntries",
// close project panel as project file panel on the right
"q": "workspace::ToggleLeftDock",
"\\": "workspace::ToggleLeftDock",
"space e": "workspace::ToggleLeftDock",
"escape": "workspace::ToggleLeftDock",
"shift-g": "menu::SelectLast",
"g g": "menu::SelectFirst",
// searches
"space s f": "file_finder::Toggle",
"space s g": "pane::DeploySearch",
// Open recent project
"space s p": [
"projects::OpenRecent",
{
"create_new_window": false,
},
],
// git
"space g p": "git_panel::ToggleFocus",
"space g g": [
"task::Spawn",
{
"task_name": "lazygit",
"reveal_target": "center",
},
],
},
},
// git panel
{
"context": "GitPanel && !CommitEditor",
"bindings": {
"q": "workspace::ToggleLeftDock",
"escape": "workspace::ToggleLeftDock",
},
},
{
"context": "GitPanel && CommitEditor",
"bindings": {
"escape": "workspace::ToggleLeftDock",
},
},
// terminal panel
{
"context": "Terminal",
"bindings": {
"ctrl-shift-h": "pane::ActivatePreviousItem",
"ctrl-shift-l": "pane::ActivateNextItem",
"ctrl-shift-q": "pane::CloseActiveItem",
"ctrl-shift-x": "pane::CloseActiveItem",
"ctrl-shift-o": "workspace::NewTerminal",
"ctrl-shift-r": "terminal::RerunTask",
// disable
"ctrl-enter": null,
},
},
// close project panel on ctrl+c / esc
{
"context": "ProjectSearchBar > Editor",
"bindings": {
"ctrl-c": "pane::CloseActiveItem",
"escape": "pane::CloseActiveItem",
},
},
// =========================
// VIM/EDITOR MODE KEYBINDINGS
// =========================
// code action (vim operator)
{
"context": "Editor && vim_operator == c",
"bindings": {
"c": "vim::CurrentLine",
"a": "editor::ToggleCodeActions", // zed specific
},
},
// completions toggle
{
"context": "Editor && showing_completions",
"bindings": {
"tab": "editor::Tab", // override tab to actually tab!
"enter": "editor::Newline", // override enter to actually enter!
"ctrl-enter": "editor::ConfirmCompletion",
"shift-enter": "editor::ConfirmCompletion",
"ctrl-y": "editor::ConfirmCompletion",
},
},
// code Actions
{
"context": "Editor && showing_code_actions",
"bindings": {
"tab": "editor::Tab", // override tab to actually tab!
"enter": "editor::Newline", // override enter to actually enter!
"ctrl-enter": "editor::ConfirmCodeAction",
"shift-enter": "editor::ConfirmCodeAction",
"ctrl-y": "editor::ConfirmCodeAction",
},
},
// edit prediction
{
"context": "Editor && edit_prediction && !showing_completions",
"bindings": {
"tab": "editor::Tab", // override tab to actually tab!
"enter": "editor::Newline", // override enter to actually enter!
// "ctrl-enter": "editor::AcceptEditPrediction", // issue: https://github.com/zed-industries/zed/issues/52559
"shift-enter": "editor::AcceptEditPrediction",
// "ctrl-y": "editor::AcceptEditPrediction", // issue: https://github.com/zed-industries/zed/issues/40161#issuecomment-3499689366
},
},
// move line (visual mode)
{
"context": "Editor && vim_mode == visual && !VimWaiting && !VimObject",
"bindings": {
"shift-j": "editor::MoveLineDown",
"shift-k": "editor::MoveLineUp",
},
},
// surround like mini.surround
{
"context": "Editor && ( vim_mode == normal || vim_mode == visual ) && !VimWaiting && !VimObject",
"bindings": {
"g s a": "vim::PushAddSurrounds",
"g s d": "vim::PushDeleteSurrounds",
"g s r": "vim::PushChangeSurrounds",
},
},
// system clipboard
{
"context": "Editor && ( vim_mode == normal || vim_mode == visual ) && !VimWaiting && !VimObject",
"bindings": {
"g y": ["workspace::SendKeystrokes", "\" + y"],
},
},
{
"context": "Editor && vim_mode == normal && !VimWaiting && !VimObject",
"bindings": {
"g P": ["workspace::SendKeystrokes", "\" + P"],
"g p": ["workspace::SendKeystrokes", "\" + p"],
},
},
{
"context": "Editor && vim_mode == visual && !VimWaiting && !VimObject",
"bindings": {
"g p": ["workspace::SendKeystrokes", "\" + p"],
"g P": ["workspace::SendKeystrokes", "\" + p"],
},
},
// indent/unindent (visual mode)
{
"context": "Editor && vim_mode == visual && !VimWaiting && !VimObject",
"bindings": {
">": ["workspace::SendKeystrokes", "> g v"],
"<": ["workspace::SendKeystrokes", "< g v"],
},
},
// various insert mode keymaps
{
"context": "vim_mode == insert",
"bindings": {
// exit out of insert mode
"ctrl-c": "vim::NormalBefore",
"ctrl-[": "vim::NormalBefore",
"escape": "vim::NormalBefore",
"ctrl-x": null, // disable
"ctrl-x ctrl-o": "editor::ShowCompletions",
// "ctrl-x ctrl-a": "assistant::InlineAssist", // zed specific
"ctrl-x ctrl-a": null, // disabled
"ctrl-x ctrl-c": "editor::ShowEditPrediction", // zed specific
"ctrl-x ctrl-l": "editor::ToggleCodeActions", // zed specific
"ctrl-x ctrl-z": "editor::Cancel",
"ctrl-w": "editor::DeleteToPreviousWordStart",
"ctrl-u": "editor::DeleteToBeginningOfLine",
"ctrl-t": "vim::Indent",
"ctrl-d": "vim::Outdent",
"ctrl-k": ["vim::PushDigraph", {}],
"ctrl-v": ["vim::PushLiteral", {}],
"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.
"ctrl-q": ["vim::PushLiteral", {}],
"ctrl-shift-q": ["vim::PushLiteral", {}],
"ctrl-r": "vim::PushRegister",
"insert": "vim::ToggleReplace",
"ctrl-o": "vim::TemporaryNormal",
"ctrl-s": "editor::ShowSignatureHelp",
},
},
// escape insert mode
// {
// "context": "Editor && vim_mode == insert && !menu",
// "bindings": {
// "j j": "vim::NormalBefore", // remap jj in insert mode to escape
// "j k": "vim::NormalBefore" // remap jk in insert mode to escape
// }
// },
// enables sneak motion (subpar alternative to flash.nvim)
// flash-style feature is coming ! see: https://github.com/zed-industries/zed/issues/14801
{
"context": "vim_mode == normal || vim_mode == visual",
"bindings": {
"s": ["vim::PushSneak", {}],
"S": ["vim::PushSneakBackward", {}],
},
},
// bracket text objects (prefers mini style)
{
"context": "vim_operator == a || vim_operator == i || vim_operator == cs || vim_operator == sa",
"bindings": {
"b": "vim::MiniBrackets",
"q": "vim::MiniQuotes",
},
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment