update zed keybindings

This commit is contained in:
Alexander Navarro 2026-02-09 16:06:08 -03:00
parent 42abb59588
commit cad4e125f4
3 changed files with 268 additions and 176 deletions

View file

@ -1,188 +1,204 @@
[ [
{ {
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu", "bindings": {
"bindings": { "ctrl-h": "workspace::ActivatePaneLeft",
// Git "ctrl-l": "workspace::ActivatePaneRight",
"enter": "vim::PushSneak", "ctrl-k": "workspace::ActivatePaneUp",
// Toggle inlay hints "ctrl-j": "workspace::ActivatePaneDown",
"space u i": "editor::ToggleInlayHints",
// NOTE: Toggle Zen mode, not fully working yet "ctrl-shift-t": "terminal_panel::ToggleFocus"
"space u z": "workspace::ToggleZoom", }
},
// Open recent project {
"space f p": "projects::OpenRecent", // Normal mode
// Search word under cursor "context": "Editor && VimControl && !VimWaiting && !menu",
"space f w": "pane::DeploySearch", "bindings": {
"ctrl-t": "terminal_panel::ToggleFocus",
"space": null,
"|": "pane::SplitVertical",
// Go to file with `gf` "J": "vim::JoinLinesNoWhitespace",
"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::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"
}
},
{
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
"|": "pane::SplitVertical",
// Window movement bindings "s": null,
// Ctrl jklk to move between panes "s a": "vim::PushAddSurrounds",
"ctrl-h": "workspace::ActivatePaneLeft", "s d": "vim::PushDeleteSurrounds",
"ctrl-l": "workspace::ActivatePaneRight", "s c": "vim::PushChangeSurrounds",
"ctrl-k": "workspace::ActivatePaneUp",
"ctrl-j": "workspace::ActivatePaneDown",
"space e": "pane::RevealInProjectPanel", "g S": "editor::SplitSelectionIntoLines",
"g s": "editor::SortLinesCaseSensitive",
"g m": "editor::DuplicateLineDown",
"g M": "editor::DuplicateLineUp",
// +LSP "g x": "vim::Exchange",
"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::GoToPreviousDiagnostic",
// Symbol search "enter": "vim::PushSneak",
"space f o": "outline::Toggle",
"space f O": "project_symbols::Toggle",
// Diagnostic "space u i": "editor::ToggleInlayHints",
"space f q": "diagnostics::Deploy",
// +Git "space u z": "workspace::ToggleZoom",
// Git prev/next hunk
"space g j": "editor::GoToHunk",
"space g k": "editor::GoToPreviousHunk",
// + Buffers "space f p": "projects::OpenRecent",
// Switch between buffers
"shift-h": "pane::ActivatePreviousItem",
"shift-l": "pane::ActivateNextItem",
// Close active panel "space u u": "workspace::CloseAllDocks",
"space b c": "pane::CloseActiveItem",
"space b d": "pane::CloseActiveItem", "space f w": "pane::DeploySearch", // Search word under cursor
// Close other items
"space b o": "pane::CloseOtherItems", // Go to file with `gf`
// Save file "g f": "editor::OpenExcerpts",
"ctrl-s": "workspace::Save",
// File finder "space e": "pane::RevealInProjectPanel",
"space f f": "file_finder::Toggle",
// Project search "space l a": "editor::ToggleCodeActions",
"space f W": "pane::DeploySearch" "space l r": "editor::Rename",
} "g d": "editor::GoToDefinition",
}, "g D": "editor::GoToDefinitionSplit",
{ "g i": "editor::GoToImplementation",
"context": "Editor && vim_mode == visual", "g I": "editor::GoToImplementationSplit",
"bindings": { "g t": "editor::GoToTypeDefinition",
"shift-j": "editor::MoveLineDown", "g T": "editor::GoToTypeDefinitionSplit",
"shift-k": "editor::MoveLineUp" "g r": "editor::FindAllReferences",
} "space l j": "editor::GoToDiagnostic",
}, "space l k": "editor::GoToPreviousDiagnostic",
// Empty pane, set of keybindings that are available when there is no active editor
{ "space f o": "outline::Toggle", // Symbol search
"context": "(EmptyPane || SharedScreen) && vim_mode != insert", "space f O": "project_symbols::Toggle",
"bindings": {
// Open file finder "space f q": "diagnostics::Deploy",
"space f f": "file_finder::Toggle",
// Open recent project // +Git
"space f p": "projects::OpenRecent" "space g G": "git_panel::ToggleFocus",
} "space g g": [
}, "task::Spawn",
{ { "task_name": "LazyGit", "reveal_target": "center" }
"context": "Workspace", ],
"bindings": { "space g j": "editor::GoToHunk",
"ctrl-t": "terminal_panel::ToggleFocus" "space g k": "editor::GoToPreviousHunk",
}
}, // + Buffers
{ // Switch between buffers
"context": "Terminal", "shift-h": "pane::ActivatePreviousItem",
"bindings": { "shift-l": "pane::ActivateNextItem",
"ctrl-h": "workspace::ActivatePaneLeft",
"ctrl-l": "workspace::ActivatePaneRight", // Close active panel
"ctrl-k": "workspace::ActivatePaneUp", "space b c": "pane::CloseActiveItem",
"ctrl-j": "workspace::ActivatePaneDown" "space b d": "pane::CloseActiveItem",
} // Close other items
}, "space b o": "pane::CloseOtherItems",
// File panel (netrw) // Save file
{ "ctrl-s": "workspace::Save",
"context": "ProjectPanel && not_editing", // File finder
"bindings": { "space f f": "file_finder::Toggle",
"a": "project_panel::NewFile", // Project search
"A": "project_panel::NewDirectory", "space f W": "pane::DeploySearch"
"r": "project_panel::Rename", }
"d": "project_panel::Delete", },
"x": "project_panel::Cut", {
"c": "project_panel::Copy", "context": "vim_mode == visual",
"p": "project_panel::Paste", "bindings": {
"y": "workspace::CopyRelativePath", "p": ["vim::Paste", { "preserve_clipboard": true }],
"Y": "workspace::CopyPath",
"o": ["project_panel::Open", "workspace::toggleLeftDock"], "shift-j": "editor::MoveLineDown",
// Close project panel as project file panel on the right "shift-k": "editor::MoveLineUp",
// Navigate between panel
"ctrl-h": "workspace::ActivatePaneLeft", "shift-s": "vim::PushAddSurrounds",
"ctrl-l": "workspace::ActivatePaneRight", "g x": "vim::Exchange",
"ctrl-k": "workspace::ActivatePaneUp", "g s": "editor::SortLinesCaseSensitive",
"ctrl-j": "workspace::ActivatePaneDown", "g S": "editor::SplitSelectionIntoLines",
"space e": "workspace::ToggleLeftDock" "g m": "editor::DuplicateSelection"
} }
}, },
// Panel nagivation {
{ // Empty pane, set of keybindings that are available when there is no active editor
"context": "Dock", "context": "(EmptyPane || SharedScreen) && vim_mode != insert",
"bindings": { "bindings": {
"ctrl-w h": "workspace::ActivatePaneLeft", // Open file finder
"ctrl-w l": "workspace::ActivatePaneRight", "space f f": "file_finder::Toggle",
"ctrl-w k": "workspace::ActivatePaneUp", // Open recent project
"ctrl-w j": "workspace::ActivatePaneDown" "space f p": "projects::OpenRecent"
} }
}, },
{ {
"context": "vim_operator == a || vim_operator == i || vim_operator == cs", "context": "Terminal",
"bindings": { "bindings": {
// mini.ai plugin behavior "ctrl-shift-n": "workspace::NewTerminal",
"\"": "vim::MiniQuotes", "ctrl-shift-h": "pane::ActivatePreviousItem",
"[": "vim::MiniBrackets", "ctrl-shift-l": "pane::ActivateNextItem",
"]": "vim::MiniBrackets", "ctrl-tab": "pane::ActivatePreviousItem",
"q": "vim::MiniQuotes", "ctrl-shift-tab": "pane::ActivateNextItem",
"b": "vim::MiniBrackets" "ctrl-shift-t": "workspace::CloseActiveDock",
}
}, "ctrl-!": ["pane::ActivateItem", 0],
{ "ctrl-\"": ["pane::ActivateItem", 1],
"context": "vim_mode == visual", "ctrl-#": ["pane::ActivateItem", 2],
"bindings": { "ctrl-$": ["pane::ActivateItem", 3],
"shift-s": "vim::PushAddSurrounds", "ctrl-%": ["pane::ActivateItem", 4],
"g x": "vim::Exchange" "ctrl-&": ["pane::ActivateItem", 5],
} "ctrl-/": ["pane::ActivateItem", 6],
} "ctrl-(": ["pane::ActivateItem", 7],
"ctrl-)": ["pane::ActivateItem", 8]
}
},
// File panel (netrw)
{
"context": "ProjectPanel",
"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"
}
},
// Panel nagivation
{
"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"
}
}
] ]

View file

@ -7,6 +7,7 @@
// custom settings, run `zed: open default settings` from the // custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p) // command palette (cmd-shift-p / ctrl-shift-p)
{ {
"semantic_tokens": "combined",
"formatter": "language_server", "formatter": "language_server",
"zoomed_padding": false, "zoomed_padding": false,
"auto_install_extensions": { "auto_install_extensions": {
@ -46,7 +47,8 @@
}, },
"scroll_beyond_last_line": "vertical_scroll_margin", "scroll_beyond_last_line": "vertical_scroll_margin",
"which_key": { "which_key": {
"enabled": true "enabled": true,
"delay_ms": 500
}, },
"rounded_selection": true, "rounded_selection": true,
"current_line_highlight": "gutter", "current_line_highlight": "gutter",

74
configs/zed/tasks.json Normal file
View file

@ -0,0 +1,74 @@
// Project tasks configuration. See https://zed.dev/docs/tasks for documentation.
//
// Example:
[
{
"label": "LazyGit",
"command": "lazygit",
"shell": {
"program": "sh"
},
"hide": "on_success",
"reveal_target": "center",
"show_summary": false,
"show_command": false,
"allow_concurrent_runs": true,
"use_new_terminal": true
},
{
"label": "Bun Test",
"command": "bun test",
"args": ["\"$ZED_RELATIVE_FILE\" -t=\"$ZED_SYMBOL\""],
"tags": ["js-test", "ts-test", "bun-test", "tsx-test"]
},
{
"label": "Example task",
"command": "for i in {1..5}; do echo \"Hello $i/5\"; sleep 1; done",
//"args": [],
// Env overrides for the command, will be appended to the terminal's environment from the settings.
"env": { "foo": "bar" },
// Current working directory to spawn the command into, defaults to current project root.
//"cwd": "/path/to/working/directory",
// Whether to use a new terminal tab or reuse the existing one to spawn the process, defaults to `false`.
"use_new_terminal": false,
// Whether to allow multiple instances of the same task to be run, or rather wait for the existing ones to finish, defaults to `false`.
"allow_concurrent_runs": false,
// What to do with the terminal pane and tab, after the command was started:
// * `always` always show the task's pane, and focus the corresponding tab in it (default)
// * `no_focus` always show the task's pane, add the task's tab in it, but don't focus it
// * `never` do not alter focus, but still add/reuse the task's tab in its pane
"reveal": "always",
// Where to place the task's terminal item after starting the task:
// * `dock` in the terminal dock, "regular" terminal items' place (default)
// * `center` in the central pane group, "main" editor area
"reveal_target": "dock",
// What to do with the terminal pane and tab, after the command had finished:
// * `never` Do nothing when the command finishes (default)
// * `always` always hide the terminal tab, hide the pane also if it was the last tab in it
// * `on_success` hide the terminal tab on task success only, otherwise behaves similar to `always`
"hide": "never",
// Which shell to use when running a task inside the terminal.
// May take 3 values:
// 1. (default) Use the system's default terminal configuration in /etc/passwd
// "shell": "system"
// 2. A program:
// "shell": {
// "program": "sh"
// }
// 3. A program with arguments:
// "shell": {
// "with_arguments": {
// "program": "/bin/bash",
// "args": ["--login"]
// }
// }
"shell": "system",
// Whether to show the task line in the output of the spawned task, defaults to `true`.
"show_summary": true,
// Whether to show the command line in the output of the spawned task, defaults to `true`.
"show_command": true
// Represents the tags for inline runnable indicators, or spawning multiple tasks at once.
// "tags": []
}
]