mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 23:20:18 +01:00
2dcdc4f216
In the JetBrains keymap, `ctrl-k` (`cmd-k` on macOS) toggles focus on the Git Panel. If the panel is on History, the shortcut leaves you there instead of taking you to the commit message. This PR binds the shortcut to `git_panel::FocusEditor` and makes that action available from the workspace. It opens the Git Panel, switches to Changes, shows the commit editor if hidden, and focuses it. Pressing the shortcut again keeps focus on the commit message. `alt-0` / `cmd-0` still toggles focus between the Git Panel and the editor, and the existing `tab` / `shift-tab` bindings in the changes list keep their behavior. ## Testing Manually tested on Linux (Fedora 44, Wayland) with a debug build and `"base_keymap": "JetBrains"`. 1. With the Git Panel on History and the editor focused, press `ctrl-k`: the panel switches to Changes and focuses the commit message. 2. Repeat with the History list focused and with the Git Panel closed. 3. Hide the commit editor and press `ctrl-k`: it becomes visible and receives focus. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed `ctrl-k` (`cmd-k` on macOS) in the JetBrains keymap to focus the commit message, including when the Git Panel is on History or closed. --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
230 lines
8.3 KiB
JSON
230 lines
8.3 KiB
JSON
[
|
|
{
|
|
"bindings": {
|
|
"ctrl-alt-s": "zed::OpenSettings",
|
|
"ctrl-{": "pane::ActivatePreviousItem",
|
|
"ctrl-}": "pane::ActivateNextItem",
|
|
"shift-escape": null, // Unmap workspace::zoom
|
|
"ctrl-~": "git::Branch",
|
|
"ctrl-f2": "debugger::Stop",
|
|
"f6": "debugger::Pause",
|
|
"f7": "debugger::StepInto",
|
|
"f8": "debugger::StepOver",
|
|
"shift-f8": "debugger::StepOut",
|
|
"f9": "debugger::Continue",
|
|
"shift-f9": "debugger::Start",
|
|
"alt-shift-f9": "debugger::Start",
|
|
},
|
|
},
|
|
{
|
|
"context": "Editor",
|
|
"bindings": {
|
|
"ctrl->": ["zed::IncreaseBufferFontSize", { "persist": true }],
|
|
"ctrl-<": ["zed::DecreaseBufferFontSize", { "persist": true }],
|
|
"ctrl-shift-j": "editor::JoinLines",
|
|
"ctrl-d": "editor::DuplicateSelection",
|
|
"ctrl-y": "editor::DeleteLine",
|
|
"ctrl-m": "editor::ScrollCursorCenter",
|
|
"ctrl-pagedown": "editor::MovePageDown",
|
|
"ctrl-pageup": "editor::MovePageUp",
|
|
// "ctrl-alt-shift-b": "editor::SelectToPreviousWordStart",
|
|
"ctrl-alt-enter": "editor::NewlineAbove",
|
|
"shift-enter": "editor::NewlineBelow",
|
|
// "ctrl--": "editor::Fold", // TODO: `ctrl-numpad--` (numpad not implemented)
|
|
// "ctrl-+": "editor::UnfoldLines", // TODO: `ctrl-numpad+` (numpad not implemented)
|
|
"alt-shift-g": "editor::SplitSelectionIntoLines",
|
|
"alt-j": ["editor::SelectNext", { "replace_newest": false }],
|
|
"alt-shift-j": ["editor::SelectPrevious", { "replace_newest": false }],
|
|
"ctrl-/": ["editor::ToggleComments", { "advance_downwards": true, "comment_empty_lines": true }],
|
|
"ctrl-w": "editor::SelectLargerSyntaxNode",
|
|
"ctrl-shift-w": "editor::SelectSmallerSyntaxNode",
|
|
"shift-alt-up": "editor::MoveLineUp",
|
|
"shift-alt-down": "editor::MoveLineDown",
|
|
"ctrl-alt-l": "editor::Format",
|
|
"ctrl-alt-o": "editor::OrganizeImports",
|
|
"shift-f6": "editor::Rename",
|
|
"ctrl-alt-left": "pane::GoBack",
|
|
"ctrl-alt-right": "pane::GoForward",
|
|
"alt-f7": "editor::FindAllReferences",
|
|
"ctrl-alt-f7": "editor::FindAllReferences",
|
|
"ctrl-b": "editor::GoToDefinition", // Conflicts with workspace::ToggleLeftDock
|
|
"ctrl-alt-b": "editor::GoToImplementation", // Conflicts with workspace::ToggleRightDock
|
|
"ctrl-shift-b": "editor::GoToTypeDefinition",
|
|
"ctrl-alt-shift-b": "editor::GoToTypeDefinitionSplit",
|
|
"f2": "editor::GoToDiagnostic",
|
|
"shift-f2": "editor::GoToPreviousDiagnostic",
|
|
"ctrl-alt-shift-down": "editor::GoToHunk",
|
|
"ctrl-alt-shift-up": "editor::GoToPreviousHunk",
|
|
"ctrl-alt-z": "git::Restore",
|
|
"ctrl-home": "editor::MoveToBeginning",
|
|
"ctrl-end": "editor::MoveToEnd",
|
|
"ctrl-shift-home": "editor::SelectToBeginning",
|
|
"ctrl-shift-end": "editor::SelectToEnd",
|
|
"alt-left": "editor::MoveToPreviousSubwordStart",
|
|
"alt-right": "editor::MoveToNextSubwordEnd",
|
|
"shift-alt-left": "editor::SelectToPreviousSubwordStart",
|
|
"shift-alt-right": "editor::SelectToNextSubwordEnd",
|
|
"ctrl-f8": "editor::ToggleBreakpoint",
|
|
"ctrl-shift-f8": "editor::EditLogBreakpoint",
|
|
"ctrl-shift-u": "editor::ToggleCase",
|
|
},
|
|
},
|
|
{
|
|
"context": "Editor && mode == full",
|
|
"bindings": {
|
|
"ctrl-f12": "outline::Toggle",
|
|
"ctrl-r": ["buffer_search::Deploy", { "replace_enabled": true }],
|
|
"ctrl-e": "file_finder::Toggle",
|
|
"ctrl-shift-n": "file_finder::Toggle",
|
|
"ctrl-alt-n": "file_finder::Toggle",
|
|
"ctrl-g": "go_to_line::Toggle",
|
|
"alt-enter": "editor::ToggleCodeActions",
|
|
"ctrl-space": "editor::ShowCompletions",
|
|
"ctrl-q": "editor::Hover",
|
|
"ctrl-p": "editor::ShowSignatureHelp",
|
|
"ctrl-\\": "assistant::InlineAssist",
|
|
"ctrl-alt-h": "call_hierarchy::ShowIncomingCalls",
|
|
},
|
|
},
|
|
{
|
|
"context": "Editor && mode == auto_height",
|
|
"bindings": {
|
|
"shift-enter": "editor::Newline",
|
|
"ctrl-shift-enter": "editor::NewlineBelow",
|
|
},
|
|
},
|
|
{
|
|
"context": "BufferSearchBar && !in_replace > Editor",
|
|
"bindings": {
|
|
"shift-enter": "search::SelectPreviousMatch",
|
|
},
|
|
},
|
|
{
|
|
"context": "AcpThreadSearchBar > Editor",
|
|
"bindings": {
|
|
"shift-enter": "agent::SelectPreviousThreadMatch",
|
|
},
|
|
},
|
|
{
|
|
"context": "BufferSearchBar || ProjectSearchBar",
|
|
"bindings": {
|
|
"alt-c": "search::ToggleCaseSensitive",
|
|
"alt-e": "search::ToggleSelection",
|
|
"alt-x": "search::ToggleRegex",
|
|
"alt-w": "search::ToggleWholeWord",
|
|
},
|
|
},
|
|
{
|
|
"context": "Workspace",
|
|
"bindings": {
|
|
"ctrl-shift-f12": "workspace::ToggleAllDocks",
|
|
"ctrl-shift-r": ["pane::DeploySearch", { "replace_enabled": true }],
|
|
"alt-shift-f10": "task::Spawn",
|
|
"shift-f10": "task::Spawn",
|
|
"ctrl-f5": "task::Rerun",
|
|
"ctrl-e": "file_finder::Toggle",
|
|
"ctrl-k": "git_panel::FocusEditor",
|
|
"ctrl-shift-n": "file_finder::Toggle",
|
|
"ctrl-alt-n": "file_finder::Toggle",
|
|
"ctrl-n": "project_symbols::Toggle",
|
|
"ctrl-shift-a": "command_palette::Toggle",
|
|
"shift shift": "command_palette::Toggle",
|
|
"ctrl-alt-shift-n": "project_symbols::Toggle",
|
|
"alt-0": "git_panel::ToggleFocus",
|
|
"alt-1": "project_panel::ToggleFocus",
|
|
"alt-5": "debug_panel::ToggleFocus",
|
|
"alt-6": "diagnostics::Deploy",
|
|
"alt-7": "outline_panel::ToggleFocus",
|
|
},
|
|
},
|
|
{
|
|
"context": "Pane", // this is to override the default Pane mappings to switch tabs
|
|
"bindings": {
|
|
"alt-1": "project_panel::ToggleFocus",
|
|
"alt-2": null, // Bookmarks (left dock)
|
|
"alt-3": null, // Find Panel (bottom dock)
|
|
"alt-4": null, // Run Panel (bottom dock)
|
|
"alt-5": "debug_panel::ToggleFocus",
|
|
"alt-6": "diagnostics::Deploy",
|
|
"alt-7": "outline_panel::ToggleFocus",
|
|
"alt-8": null, // Services (bottom dock)
|
|
"alt-9": null, // Git History (bottom dock)
|
|
"alt-0": "git_panel::ToggleFocus",
|
|
},
|
|
},
|
|
{
|
|
"context": "Workspace || Editor",
|
|
"bindings": {
|
|
"alt-f12": "terminal_panel::Toggle",
|
|
"ctrl-shift-k": "git::Push",
|
|
},
|
|
},
|
|
{
|
|
"context": "Pane",
|
|
"bindings": {
|
|
"ctrl-alt-left": "pane::GoBack",
|
|
"ctrl-alt-right": "pane::GoForward",
|
|
"alt-left": "pane::ActivatePreviousItem",
|
|
"alt-right": "pane::ActivateNextItem",
|
|
},
|
|
},
|
|
{
|
|
"context": "ProjectPanel",
|
|
"bindings": {
|
|
"enter": "project_panel::Open",
|
|
"ctrl-shift-f": "project_panel::NewSearchInDirectory",
|
|
"backspace": ["project_panel::Trash", { "skip_prompt": false }],
|
|
"delete": ["project_panel::Trash", { "skip_prompt": false }],
|
|
"shift-delete": ["project_panel::Delete", { "skip_prompt": false }],
|
|
"shift-f6": "project_panel::Rename",
|
|
},
|
|
},
|
|
{
|
|
"context": "Terminal",
|
|
"bindings": {
|
|
"ctrl-shift-t": "workspace::NewTerminal",
|
|
"alt-f12": "workspace::CloseActiveDock",
|
|
"ctrl-up": "terminal::ScrollLineUp",
|
|
"ctrl-down": "terminal::ScrollLineDown",
|
|
"shift-pageup": "terminal::ScrollPageUp",
|
|
"shift-pagedown": "terminal::ScrollPageDown",
|
|
},
|
|
},
|
|
{ "context": "GitPanel", "bindings": { "alt-0": "workspace::CloseActiveDock" } },
|
|
{ "context": "ProjectPanel", "bindings": { "alt-1": "workspace::CloseActiveDock" } },
|
|
{ "context": "DebugPanel", "bindings": { "alt-5": "workspace::CloseActiveDock" } },
|
|
{ "context": "Diagnostics > Editor", "bindings": { "alt-6": "pane::CloseActiveItem" } },
|
|
{ "context": "OutlinePanel", "bindings": { "alt-7": "workspace::CloseActiveDock" } },
|
|
{
|
|
// `ctrl-alt-l` is bound to `editor::Format` (jetbrains "Reformat Code") in
|
|
// the Editor context above, which collides with the default
|
|
// `agent::OpenRulesLibrary` binding. Mirror the windows keymap and use
|
|
// `shift-alt-l` instead so the menu hint and the action stay in sync.
|
|
"context": "AgentPanel",
|
|
"bindings": {
|
|
"ctrl-alt-l": null,
|
|
"shift-alt-l": "agent::OpenRulesLibrary",
|
|
},
|
|
},
|
|
{
|
|
"context": "Dock || Workspace || OutlinePanel || ProjectPanel || CollabPanel",
|
|
"bindings": {
|
|
"escape": "editor::ToggleFocus",
|
|
"shift-escape": "workspace::CloseActiveDock",
|
|
},
|
|
},
|
|
{
|
|
"context": "Editor && mode == auto_height",
|
|
"bindings": {
|
|
"escape": "editor::Cancel",
|
|
},
|
|
},
|
|
{
|
|
"context": "CallHierarchyPicker > Picker > Editor",
|
|
"bindings": {
|
|
"ctrl-alt-h": "call_hierarchy::ToggleDirection",
|
|
"ctrl-k": null,
|
|
},
|
|
},
|
|
]
|