Files
dotfiles/common/.config/zed/keymap.json
2026-02-18 22:51:14 +05:30

236 lines
7.7 KiB
JSON

// TIP: To see the default key bindings run `zed: open default keymap`
// ISSUES:
// - Bash support: buffer symbol search doesn't work
// - Git: Not nearly as useful as Neovim > Gitsigns
// TODO:
// - Git stage multi-buffer: reduce the file name ribbon size
// - AI:
// - Set shortcuts:
// - Toggle left panel
// - Increase/Decrease panel size
[
{
"context": "Workspace && vim_mode == normal",
"bindings": {
"ctrl-/": "journal::NewJournalEntry",
"ctrl-1": "project_panel::ToggleFocus",
"ctrl-2": "git_panel::ToggleFocus",
"ctrl-3": "outline_panel::ToggleFocus",
"ctrl-4": "debug_panel::ToggleFocus",
"ctrl-5": "notification_panel::ToggleFocus",
"space tab": "workspace::ToggleLeftDock"
}
},
{
"context": "ProjectPanel && not_editing",
"bindings": {
"q": "workspace::ToggleLeftDock",
"space tab": "workspace::ToggleLeftDock"
}
},
{
"context": "GitDiff > Editor",
"bindings": {
"s": "git::ToggleStaged",
"x": "git::Restore",
"c": "git::Commit"
}
},
{
"context": "Dock",
"bindings": {
"ctrl-w h": "workspace::ActivatePaneLeft",
"ctrl-w l": "workspace::ActivatePaneRight",
"ctrl-w k": "workspace::ActivatePaneUp",
"ctrl-w j": "workspace::ActivatePaneDown"
}
},
{
"context": "Picker",
"bindings": {
"ctrl-[": "menu::Cancel"
}
},
{
"context": "BufferSearchBar",
"bindings": {
"ctrl-[": "buffer_search::Dismiss"
}
},
{
"context": "ProjectSearchBar",
"bindings": {
"ctrl-[": "project_search::ToggleFocus"
}
},
{
"context": "Terminal",
"bindings": {
// Don't let ctrl-p & ctrl-n be high jacked
"ctrl-p": [
"terminal::SendKeystroke",
"ctrl-p"
],
"ctrl-n": [
"terminal::SendKeystroke",
"ctrl-n"
],
"ctrl-shift-up": "workspace::IncreaseActiveDockSize",
"ctrl-shift-down": "workspace::DecreaseActiveDockSize",
"ctrl-shift-enter": "workspace::NewTerminal"
}
},
{
"context": "Editor && ( vim_mode == visual || vim_mode == normal )",
"bindings": {
// Access system clipboard
"space p": "editor::Paste",
"space y": "editor::Copy"
}
},
{
"context": "Editor && vim_mode == visual",
"bindings": {
// Move line up/down with J/K
"J": "editor::MoveLineDown",
"K": "editor::MoveLineUp"
}
},
{
"context": "Editor && vim_mode == normal",
"bindings": {
// Useful Zed-VIM defaults:
// Go to declaration => gD
// Go to type definition => gy
// Go to implementation => gI
// Rename (change definition) => cd
// Go to All references to the current word => gA
// Find symbol in current file => gs
// Find symbol in project => gS
// Show inline error (hover) => gh
// Open the code actions menu => g.
//
// Multi-cursor:
// Add a cursor selecting the next copy of the current word => gl
// Add a visual selection for every copy of the current word => ga
// Add a cursor selecting the previous copy of the current word => gL
// Skip latest word selection, and add next => g>
// Skip latest word selection, and add previous => g<
//
// https://github.com/tommcdo/vim-exchange
// https://github.com/jeetsukumaran/vim-indentwise
//
// AI:
// Accept edit-prediction on Linux => alt-l
// Accept next predicted word => alt-right
"space tab": "project_panel::ToggleFocus",
"space / /": "journal::NewJournalEntry",
"ctrl-escape": "workspace::ToggleCenteredLayout",
// Coding & Code Navigation
"] ]": "vim::GoToNextReference",
"[ [": "vim::GoToPreviousReference",
"] f": "vim::NextMethodStart",
"[ f": "vim::PreviousMethodStart",
"] i": "vim::NextSameIndent",
"[ i": "vim::PreviousSameIndent",
"] C": "vim::NextSectionStart",
"[ C": "vim::PreviousSectionStart",
"ctrl-space": "editor::SelectLargerSyntaxNode",
"F2": "editor::Rename",
"space r": "editor::Rename",
"space c r": "editor::FindAllReferences",
"space o": "outline::Toggle",
"space s": "outline::Toggle",
"space S": "project_symbols::Toggle",
"ctrl-.": "editor::ToggleCodeActions",
// Diagnostics
"space d w": "diagnostics::Deploy",
"space d t": "editor::ToggleInlineDiagnostics",
"space x x": "workspace::SuppressNotification",
// Git
"space g g": "git::Diff",
"space g p": "editor::ToggleSelectedDiffHunks",
"] g": "editor::GoToHunk",
"[ g": "editor::GoToPreviousHunk",
"space g s": "git::ToggleStaged",
"space g r": "git::Restore",
"space g b": "git::Branch",
"space g B": "editor::ToggleGitBlameInline",
// Buffer
"space b l": "tab_switcher::ToggleAll",
"space b x": "pane::CloseActiveItem",
"space x b": "pane::CloseActiveItem",
"space x o": "pane::CloseOtherItems",
"space b p": "pane::TogglePinTab",
// Quality of life improvements:
// Center the cursor when moving through document
"ctrl-d": [
"workspace::SendKeystrokes",
"Ctrl-d z z"
],
"ctrl-u": [
"workspace::SendKeystrokes",
"Ctrl-u z z"
],
"ctrl-o": [
"workspace::SendKeystrokes",
"Ctrl-o z z"
],
"ctrl-i": [
"workspace::SendKeystrokes",
"Ctrl-i z z"
],
"g ;": [
"workspace::SendKeystrokes",
"g ; z z"
],
"g ,": [
"workspace::SendKeystrokes",
"g , z z"
],
"n": [
"workspace::SendKeystrokes",
"n z z"
],
"N": [
"workspace::SendKeystrokes",
"N z z"
],
//
// Better split management
"ctrl-j": [
"workspace::SendKeystrokes",
"ctrl-w j"
],
"ctrl-k": [
"workspace::SendKeystrokes",
"ctrl-w k"
],
"ctrl-h": [
"workspace::SendKeystrokes",
"ctrl-w h"
],
"ctrl-l": [
"workspace::SendKeystrokes",
"ctrl-w l"
],
"ctrl-up": [
"workspace::SendKeystrokes",
"ctrl-w +"
],
"ctrl-down": [
"workspace::SendKeystrokes",
"ctrl-w -"
],
"ctrl-right": [
"workspace::SendKeystrokes",
"ctrl-w >"
],
"ctrl-left": [
"workspace::SendKeystrokes",
"ctrl-w <"
]
}
}
]