dots/configs/zed/keymap.json
2026-02-23 12:50:43 -03:00

207 lines
5.5 KiB
JSON

[
{
"bindings": {
"ctrl-h": "workspace::ActivatePaneLeft",
"ctrl-l": "workspace::ActivatePaneRight",
"ctrl-k": "workspace::ActivatePaneUp",
"ctrl-j": "workspace::ActivatePaneDown",
"ctrl-shift-t": "terminal_panel::ToggleFocus"
}
},
{
// Normal mode
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
"ctrl-t": "terminal_panel::ToggleFocus",
"space": null,
"|": "pane::SplitVertical",
"J": "vim::JoinLinesNoWhitespace",
"s": null,
"s a": "vim::PushAddSurrounds",
"s d": "vim::PushDeleteSurrounds",
"s c": "vim::PushChangeSurrounds",
"g S": "editor::SplitSelectionIntoLines",
"g s": "editor::SortLinesCaseSensitive",
"g m": "editor::DuplicateLineDown",
"g M": "editor::DuplicateLineUp",
"g x": "vim::Exchange",
"enter": "vim::PushSneak",
"space u i": "editor::ToggleInlayHints",
"space u z": "workspace::ToggleZoom",
"space f p": "projects::OpenRecent",
"space u u": "workspace::CloseAllDocks",
"space f w": "pane::DeploySearch", // Search word under cursor
"space r r": "task::Spawn",
// Go to file with `gf`
"g f": "editor::OpenExcerpts",
"space e": "pane::RevealInProjectPanel",
"space l a": "editor::ToggleCodeActions",
"space l r": "editor::Rename",
"space l D": "editor::OpenDocs",
"g d": "editor::GoToDefinition",
"g D": "editor::GoToDefinitionSplit",
"g i": "editor::GoToImplementation",
"g I": "editor::GoToImplementationSplit",
"g t": "editor::GoToTypeDefinition",
"g T": "editor::GoToTypeDefinitionSplit",
"g r": "editor::FindAllReferences",
"space l j": "editor::GoToDiagnostic",
"space l k": "editor::GoToPreviousDiagnostic",
"space f o": "outline::Toggle", // Symbol search
"space f O": "project_symbols::Toggle",
"space f q": "diagnostics::Deploy",
// +Git
"space g G": "git_panel::ToggleFocus",
"space g g": [
"task::Spawn",
{ "task_name": "LazyGit", "reveal_target": "center" }
],
"space g j": "editor::GoToHunk",
"space g k": "editor::GoToPreviousHunk",
// + Buffers
// Switch between buffers
"shift-h": "pane::ActivatePreviousItem",
"shift-l": "pane::ActivateNextItem",
// Close active panel
"space b c": "pane::CloseActiveItem",
"space b d": "pane::CloseActiveItem",
// Close other items
"space b o": "pane::CloseOtherItems",
// Save file
"ctrl-s": "workspace::Save",
// File finder
"space f f": "file_finder::Toggle",
// Project search
"space f W": "pane::DeploySearch"
}
},
{
"context": "vim_mode == visual",
"bindings": {
"p": ["vim::Paste", { "preserve_clipboard": true }],
"shift-j": "editor::MoveLineDown",
"shift-k": "editor::MoveLineUp",
"shift-s": "vim::PushAddSurrounds",
"g x": "vim::Exchange",
"g s": "editor::SortLinesCaseSensitive",
"g S": "editor::SplitSelectionIntoLines",
"g m": "editor::DuplicateSelection"
}
},
{
// Empty pane, set of keybindings that are available when there is no active editor
"context": "(EmptyPane || SharedScreen) && vim_mode != insert",
"bindings": {
// Open file finder
"space f f": "file_finder::Toggle",
// Open recent project
"space f p": "projects::OpenRecent"
}
},
{
"context": "Terminal",
"bindings": {
"ctrl-shift-n": "workspace::NewTerminal",
"ctrl-shift-h": "pane::ActivatePreviousItem",
"ctrl-shift-l": "pane::ActivateNextItem",
"ctrl-tab": "pane::ActivatePreviousItem",
"ctrl-shift-tab": "pane::ActivateNextItem",
"ctrl-shift-t": "workspace::CloseActiveDock",
"ctrl-!": ["pane::ActivateItem", 0],
"ctrl-\"": ["pane::ActivateItem", 1],
"ctrl-#": ["pane::ActivateItem", 2],
"ctrl-$": ["pane::ActivateItem", 3],
"ctrl-%": ["pane::ActivateItem", 4],
"ctrl-&": ["pane::ActivateItem", 5],
"ctrl-/": ["pane::ActivateItem", 6],
"ctrl-(": ["pane::ActivateItem", 7],
"ctrl-)": ["pane::ActivateItem", 8]
}
},
// File panel (netrw)
{
"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",
"y": "workspace::CopyRelativePath",
"Y": "workspace::CopyPath",
"o": "project_panel::OpenPermanent",
"enter": ["workspace::SendKeystrokes", "o space e"], // hack to close the file explorer on open
"space e": "workspace::ToggleLeftDock"
}
},
{
"context": "vim_operator == a || vim_operator == i || vim_operator == sc",
"bindings": {
// mini.ai plugin behavior
"\\\"": "vim::MiniQuotes",
"[": "vim::MiniBrackets",
"]": "vim::MiniBrackets",
"q": "vim::MiniQuotes",
"b": "vim::MiniBrackets"
}
},
{
"context": "vim_operator == gx",
"bindings": {
"c": "vim::ClearExchange"
}
},
{
// move context menus with Ctrl + hjkl in completions
"context": "(vim_mode == normal || vim_mode == insert) && (showing_code_actions || showing_completions)",
"bindings": {
"ctrl-h": "editor::ContextMenuPrevious",
"ctrl-j": "editor::ContextMenuNext",
"ctrl-k": "editor::ContextMenuPrevious",
"ctrl-l": "editor::ContextMenuNext"
}
},
{
"context": "Editor && (vim_mode == normal || vim_mode == insert)",
"bindings": {
"ctrl-shift-v": "editor::Paste"
}
},
{
// move context menus with Ctrl + hjkl in menus
"context": "Picker || menu",
"bindings": {
"ctrl-h": "menu::SelectPrevious",
"ctrl-j": "menu::SelectNext",
"ctrl-k": "menu::SelectPrevious",
"ctrl-l": "menu::SelectNext"
}
}
]