From e7a151de09cef1af2e0cf9dcedf55b0f8669e907 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 20 Aug 2026 00:48:05 +0000 Subject: [PATCH] keymaps: Sync debugger bindings across platforms to match VS Code (#58729) I was trying out zed after VS Code and I've stumbled upon inconsistency with debugging hotkeys. In VS Code it's f10/f11, in zed it was much more awkward f7/ctrl-f11. Investigating, I've found that I can't just override f11, because it's used by `zed::ToggleFullScreen` global hotkey and global hotkey always beats `Workspace && debugger_stopped`. Furthermore, I've found f11 hotkey is available, but only on Mac. And on Windows there was no `StepInto` hotkey at all. So configs were unsynced in that regard. Code changes: - To make f11 overridable, I've moved it to `Workspace` context - it's still pretty global, but now it's overridable. Though `Workspace && debugger_stopped` have the same depth as `Workspace`, it will take priority, because it's registered later in .json. - StepInto - added f11 hotkey for all platforms (was missing on linux and windows), kept older ctrl-f11 too as some users might be used to it. A note that on Mac F11 was added previously as `Workspace && debugger_running` - which practically means the hotkey wasn't available. `debugger_running` means debugger is running in background, user needs step commands when `debugger_stopped`- when they're actually stepping through the code. - StepOver - added f10 hotkey for all platforms (was missing on linux and mac). Kept old f7 hotkey on linux and mac, didn't added it on windows as it wasn't present before. - StepOut - it was consistently shift-f11 on all platforms already, just moved it from global context for consistency. - Removed StepOver, StepInto, StepOut from debugger_session context and kept it only in `debugger_stopped`, as this is when they're actually useful, similar to how we have `debugger::Continue"` there which also makes sense only when debugger is stopped. I've separated changes by commits, so it would be easier to review them. PS Global hotkeys overriding specific ones seems a bit odd by itself - it seems global more specific hotkeys should always have a priority, so maybe it's something to look into too. Another thing that `default-xxx.json` share a lot of hotkeys, so maintaining them separately may have other things going out of sync too. Closes #58899. ---- Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - keymaps are not tested - [x] Performance impact has been considered and is acceptable Release Notes: - Improved debugger step keybindings across platforms to match VS Code defaults while preserving fullscreen outside paused sessions --------- Co-authored-by: Kunall Banerjee --- assets/keymaps/default-linux.json | 17 ++++++++++------- assets/keymaps/default-macos.json | 20 +++++++++++--------- assets/keymaps/default-windows.json | 15 +++++++++------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index 9b94092471..7321e74a82 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -34,7 +34,6 @@ "ctrl-alt-,": "zed::OpenSettingsFile", "ctrl-q": "zed::Quit", "f4": "debugger::Start", - "f11": "zed::ToggleFullScreen", "ctrl-alt-z": "edit_prediction::RatePredictions", "ctrl-alt-shift-i": "edit_prediction::ToggleMenu", "ctrl-alt-l": "lsp_tool::ToggleMenu", @@ -633,6 +632,7 @@ "shift-f6": "workspace::FocusPreviousPart", "ctrl-f6": "workspace::FocusNextPart", "alt-open": "projects::OpenRecent", + "f11": "zed::ToggleFullScreen", // Change the default action on `menu::Confirm` by setting the parameter // "alt-ctrl-o": ["projects::OpenRecent", { "create_new_window": true }], "alt-ctrl-o": "projects::OpenRecent", @@ -774,6 +774,11 @@ "context": "Workspace && debugger_stopped", "bindings": { "f5": "debugger::Continue", + "f7": "debugger::StepOver", + "f10": "debugger::StepOver", + "f11": "debugger::StepInto", + "ctrl-f11": "debugger::StepInto", + "shift-f11": "debugger::StepOut", }, }, { @@ -1109,18 +1114,16 @@ }, }, { - // While a debug session is live, debugger controls take over their F-keys. - // `f6` becomes Pause (region navigation stays on `ctrl-f6` / `shift-f6`), - // and step/stop/rerun are scoped here so they're inert when not debugging. + // While a debug session is live, `Pause`/`Stop`/`RerunSession` take over their F-keys + // (region navigation stays on `ctrl-f6` / `shift-f6`), so they're inert when not debugging. + // Step commands and `Continue` are scoped to `debugger_stopped` instead, since they only + // make sense while execution is actually paused. // `debugger::Start` stays global so a session can be started from anywhere. "context": "Workspace && debugger_session", "bindings": { "f6": "debugger::Pause", "shift-f5": "debugger::Stop", "ctrl-shift-f5": "debugger::RerunSession", - "f7": "debugger::StepOver", - "ctrl-f11": "debugger::StepInto", - "shift-f11": "debugger::StepOut", }, }, { diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index b82f06de46..0164823602 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -38,8 +38,6 @@ "cmd-h": "zed::Hide", "alt-cmd-h": "zed::HideOthers", "cmd-m": "zed::Minimize", - "fn-f": "zed::ToggleFullScreen", - "ctrl-cmd-f": "zed::ToggleFullScreen", "ctrl-cmd-z": "edit_prediction::RatePredictions", "ctrl-cmd-i": "edit_prediction::ToggleMenu", "ctrl-cmd-l": "lsp_tool::ToggleMenu", @@ -694,6 +692,8 @@ "f6": "workspace::FocusNextPart", "shift-f6": "workspace::FocusPreviousPart", "cmd-f6": "workspace::FocusNextPart", + "fn-f": "zed::ToggleFullScreen", + "ctrl-cmd-f": "zed::ToggleFullScreen", // Change the default action on `menu::Confirm` by setting the parameter // "alt-cmd-o": ["projects::OpenRecent", {"create_new_window": true }], "alt-cmd-o": "projects::OpenRecent", @@ -823,7 +823,6 @@ // Unbind `f5` to avoid dispatching the `debugger::Rerun` as that is what `f5` is bound to in the `Workspace` // context. "f5": null, - "f11": "debugger::StepInto", }, }, { @@ -831,6 +830,11 @@ "use_key_equivalents": true, "bindings": { "f5": "debugger::Continue", + "f7": "debugger::StepOver", + "f10": "debugger::StepOver", + "f11": "debugger::StepInto", + "ctrl-f11": "debugger::StepInto", + "shift-f11": "debugger::StepOut", }, }, // Bindings from Sublime Text @@ -1165,9 +1169,10 @@ }, }, { - // While a debug session is live, debugger controls take over their F-keys. - // `f6` becomes Pause (region navigation stays on `cmd-f6` / `shift-f6`), - // and step/stop/rerun are scoped here so they're inert when not debugging. + // While a debug session is live, `Pause`/`Stop`/`RerunSession` take over their F-keys + // (region navigation stays on `cmd-f6` / `shift-f6`), so they're inert when not debugging. + // Step commands and `Continue` are scoped to `debugger_stopped` instead, since they only + // make sense while execution is actually paused. // `debugger::Start` stays global so a session can be started from anywhere. "context": "Workspace && debugger_session", "use_key_equivalents": true, @@ -1175,9 +1180,6 @@ "f6": "debugger::Pause", "shift-f5": "debugger::Stop", "shift-cmd-f5": "debugger::RerunSession", - "f7": "debugger::StepOver", - "ctrl-f11": "debugger::StepInto", - "shift-f11": "debugger::StepOut", }, }, { diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json index e9c0f12ba6..7a4ef74a71 100644 --- a/assets/keymaps/default-windows.json +++ b/assets/keymaps/default-windows.json @@ -33,7 +33,6 @@ "ctrl-alt-,": "zed::OpenSettingsFile", "ctrl-q": "zed::Quit", "f4": "debugger::Start", - "f11": "zed::ToggleFullScreen", "ctrl-shift-i": "edit_prediction::ToggleMenu", "shift-alt-l": "lsp_tool::ToggleMenu", "ctrl-shift-alt-c": "editor::DisplayCursorNames", @@ -633,6 +632,7 @@ "ctrl-f6": "workspace::FocusNextPart", // Change the default action on `menu::Confirm` by setting the parameter // "ctrl-alt-o": ["projects::OpenRecent", { "create_new_window": true }], + "f11": "zed::ToggleFullScreen", "ctrl-r": "projects::OpenRecent", // Change to open path modal for existing remote connection by setting the parameter // "ctrl-shift-alt-o": ["projects::OpenRemote", { "from_existing_connection": true }], @@ -732,6 +732,10 @@ "use_key_equivalents": true, "bindings": { "f5": "debugger::Continue", + "f10": "debugger::StepOver", + "f11": "debugger::StepInto", + "ctrl-f11": "debugger::StepInto", + "shift-f11": "debugger::StepOut", }, }, { @@ -1105,9 +1109,10 @@ }, }, { - // While a debug session is live, debugger controls take over their F-keys. - // `f6` becomes Pause (region navigation stays on `ctrl-f6` / `shift-f6`), - // and step/stop/rerun are scoped here so they're inert when not debugging. + // While a debug session is live, `Pause`/`Stop`/`RerunSession` take over their F-keys + // (region navigation stays on `ctrl-f6` / `shift-f6`), so they're inert when not debugging. + // Step commands and `Continue` are scoped to `debugger_stopped` instead, since they only + // make sense while execution is actually paused. // `debugger::Start` stays global so a session can be started from anywhere. "context": "Workspace && debugger_session", "use_key_equivalents": true, @@ -1115,8 +1120,6 @@ "f6": "debugger::Pause", "shift-f5": "debugger::Stop", "ctrl-shift-f5": "debugger::RerunSession", - "f10": "debugger::StepOver", - "shift-f11": "debugger::StepOut", }, }, {