From cad4e125f4c2d0da6ab336e2a352359638c4f9f4 Mon Sep 17 00:00:00 2001 From: aleidk Date: Mon, 9 Feb 2026 16:06:08 -0300 Subject: [PATCH] update zed keybindings --- configs/zed/keymap.json | 366 ++++++++++++++++++++------------------ configs/zed/settings.json | 4 +- configs/zed/tasks.json | 74 ++++++++ 3 files changed, 268 insertions(+), 176 deletions(-) create mode 100644 configs/zed/tasks.json diff --git a/configs/zed/keymap.json b/configs/zed/keymap.json index 42d207c..1100163 100644 --- a/configs/zed/keymap.json +++ b/configs/zed/keymap.json @@ -1,188 +1,204 @@ [ - { - "context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu", - "bindings": { - // Git - "enter": "vim::PushSneak", - // Toggle inlay hints - "space u i": "editor::ToggleInlayHints", + { + "bindings": { + "ctrl-h": "workspace::ActivatePaneLeft", + "ctrl-l": "workspace::ActivatePaneRight", + "ctrl-k": "workspace::ActivatePaneUp", + "ctrl-j": "workspace::ActivatePaneDown", - // NOTE: Toggle Zen mode, not fully working yet - "space u z": "workspace::ToggleZoom", + "ctrl-shift-t": "terminal_panel::ToggleFocus" + } + }, - // Open recent project - "space f p": "projects::OpenRecent", - // Search word under cursor - "space f w": "pane::DeploySearch", + { + // Normal mode + "context": "Editor && VimControl && !VimWaiting && !menu", + "bindings": { + "ctrl-t": "terminal_panel::ToggleFocus", + "space": null, + "|": "pane::SplitVertical", - // 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::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", + "J": "vim::JoinLinesNoWhitespace", - // Window movement bindings - // Ctrl jklk to move between panes - "ctrl-h": "workspace::ActivatePaneLeft", - "ctrl-l": "workspace::ActivatePaneRight", - "ctrl-k": "workspace::ActivatePaneUp", - "ctrl-j": "workspace::ActivatePaneDown", + "s": null, + "s a": "vim::PushAddSurrounds", + "s d": "vim::PushDeleteSurrounds", + "s c": "vim::PushChangeSurrounds", - "space e": "pane::RevealInProjectPanel", + "g S": "editor::SplitSelectionIntoLines", + "g s": "editor::SortLinesCaseSensitive", + "g m": "editor::DuplicateLineDown", + "g M": "editor::DuplicateLineUp", - // +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::GoToPreviousDiagnostic", + "g x": "vim::Exchange", - // Symbol search - "space f o": "outline::Toggle", - "space f O": "project_symbols::Toggle", + "enter": "vim::PushSneak", - // Diagnostic - "space f q": "diagnostics::Deploy", + "space u i": "editor::ToggleInlayHints", - // +Git - // Git prev/next hunk - "space g j": "editor::GoToHunk", - "space g k": "editor::GoToPreviousHunk", + "space u z": "workspace::ToggleZoom", - // + Buffers - // Switch between buffers - "shift-h": "pane::ActivatePreviousItem", - "shift-l": "pane::ActivateNextItem", + "space f p": "projects::OpenRecent", - // 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": "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::ActivatePaneLeft", - "ctrl-l": "workspace::ActivatePaneRight", - "ctrl-k": "workspace::ActivatePaneUp", - "ctrl-j": "workspace::ActivatePaneDown" - } - }, - // 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::Open", "workspace::toggleLeftDock"], - // Close project panel as project file panel on the right - // Navigate between panel - "ctrl-h": "workspace::ActivatePaneLeft", - "ctrl-l": "workspace::ActivatePaneRight", - "ctrl-k": "workspace::ActivatePaneUp", - "ctrl-j": "workspace::ActivatePaneDown", - "space e": "workspace::ToggleLeftDock" - } - }, - // Panel nagivation - { - "context": "Dock", - "bindings": { - "ctrl-w h": "workspace::ActivatePaneLeft", - "ctrl-w l": "workspace::ActivatePaneRight", - "ctrl-w k": "workspace::ActivatePaneUp", - "ctrl-w j": "workspace::ActivatePaneDown" - } - }, - { - "context": "vim_operator == a || vim_operator == i || vim_operator == cs", - "bindings": { - // mini.ai plugin behavior - "\"": "vim::MiniQuotes", - "[": "vim::MiniBrackets", - "]": "vim::MiniBrackets", - "q": "vim::MiniQuotes", - "b": "vim::MiniBrackets" - } - }, - { - "context": "vim_mode == visual", - "bindings": { - "shift-s": "vim::PushAddSurrounds", - "g x": "vim::Exchange" - } - } + "space u u": "workspace::CloseAllDocks", + + "space f w": "pane::DeploySearch", // Search word under cursor + + // Go to file with `gf` + "g f": "editor::OpenExcerpts", + + "space e": "pane::RevealInProjectPanel", + + "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", + + "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", + "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" + } + } ] diff --git a/configs/zed/settings.json b/configs/zed/settings.json index 9fcd6d2..e227f04 100644 --- a/configs/zed/settings.json +++ b/configs/zed/settings.json @@ -7,6 +7,7 @@ // custom settings, run `zed: open default settings` from the // command palette (cmd-shift-p / ctrl-shift-p) { + "semantic_tokens": "combined", "formatter": "language_server", "zoomed_padding": false, "auto_install_extensions": { @@ -46,7 +47,8 @@ }, "scroll_beyond_last_line": "vertical_scroll_margin", "which_key": { - "enabled": true + "enabled": true, + "delay_ms": 500 }, "rounded_selection": true, "current_line_highlight": "gutter", diff --git a/configs/zed/tasks.json b/configs/zed/tasks.json new file mode 100644 index 0000000..c1529b5 --- /dev/null +++ b/configs/zed/tasks.json @@ -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": [] + } +]