dots/config/zed/keymap.json

183 lines
5.5 KiB
JSON

[
{
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu",
"bindings": {
// Git
// Toggle inlay hints
"space u i": "editor::ToggleInlayHints",
// NOTE: Toggle Zen mode, not fully working yet
"space u z": "workspace::ToggleZoom",
// Open recent project
"space f p": "projects::OpenRecent",
// Search word under cursor
"space f w": "pane::DeploySearch",
// Chat with AI
"space a c": "assistant::ToggleFocus",
// Go to file with `gf`
"g f": "editor::OpenExcerpts"
}
},
{
// move context menus with Ctrl + hjkl in completions
"context": "(vim_mode == normal || vim_mode == insert) && (showing_code_actions || showing_completions)",
"bindings": {
"ctrl-h": "editor::ContextMenuPrev",
"ctrl-j": "editor::ContextMenuNext",
"ctrl-k": "editor::ContextMenuPrev",
"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::SelectPrev",
"ctrl-j": "menu::SelectNext",
"ctrl-k": "menu::SelectPrev",
"ctrl-l": "menu::SelectNext"
}
},
{
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
"|": "pane::SplitVertical",
// Window movement bindings
// Ctrl jklk to move between panes
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"],
"space e": "pane::RevealInProjectPanel",
// +LSP
"space l a": "editor::ToggleCodeActions",
"space l r": "editor::Rename",
"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::GoToPrevDiagnostic",
// Symbol search
"space f o": "outline::Toggle",
"space f O": "project_symbols::Toggle",
// Diagnostic
"space f q": "diagnostics::Deploy",
// +Git
// Git prev/next hunk
"space g j": "editor::GoToHunk",
"space g k": "editor::GoToPrevHunk",
// + Buffers
// Switch between buffers
"shift-h": "pane::ActivatePrevItem",
"shift-l": "pane::ActivateNextItem",
// Close active panel
"space b c": "pane::CloseActiveItem",
"space b d": "pane::CloseActiveItem",
// Close other items
"space b o": "pane::CloseInactiveItems",
// Save file
"ctrl-s": "workspace::Save",
// File finder
"space f f": "file_finder::Toggle",
// Project search
"space f W": "pane::DeploySearch"
}
},
{
"context": "Editor && vim_mode == visual",
"bindings": {
"shift-j": "editor::MoveLineDown",
"shift-k": "editor::MoveLineUp"
}
},
// 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": "Workspace",
"bindings": {
"ctrl-t": "terminal_panel::ToggleFocus"
}
},
{
"context": "Terminal",
"bindings": {
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"]
}
},
// 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": "project_panel::CopyRelativePath",
"Y": "project_panel::CopyPath",
"o": ["project_panel::Open", "workspace::toggleLeftDock"],
// Close project panel as project file panel on the right
// Navigate between panel
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace ::ActivatePaneInDirection", "Down"],
"space e": "workspace::ToggleLeftDock"
}
},
// Panel nagivation
{
"context": "Dock",
"bindings": {
"ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"]
}
}
// Subword motion is not working really nice with `ciw`, disable for now
// {
// "context": "VimControl && !menu",
// "bindings": {
// "w": "vim::NextSubwordStart",
// "b": "vim::PreviousSubwordStart",
// "e": "vim::NextSubwordEnd",
// "g e": "vim::PreviousSubwordEnd"
// }
// }
]