## Summary This PR improves the documentation for diff hunk keyboard shortcuts to make existing functionality more discoverable to users. ### Problem Users were unaware that pressing **ESC** already collapses all expanded diff hunks through the existing `Cancel` action. The functionality exists but lacks discoverability: - The `Cancel` action description was too generic: "Cancels the current operation" - No documentation existed for diff hunk keyboard shortcuts in the Git docs - Users would naturally expect a dedicated keybinding for collapsing diff hunks Release Notes: - N/A
Unified · Split
| @@ -112,29 +112,42 @@ by creating a [custom key bindings](key-bindings.md#custom-key-bindings) to the · 111 unmodified lines | ||
| 112 | 112 | `editor::CopyPermalinkToLine` or `editor::OpenPermalinkToLine` actions |
| 113 | 113 | or by simply right clicking and selecting `Copy Permalink` with line(s) selected in your editor. |
| 114 | 114 | |
| 115 | +## Diff Hunk Keyboard Shortcuts | |
| 116 | + | |
| 117 | +When viewing files with changes, Zed displays diff hunks that can be expanded or collapsed for detailed review: | |
| 118 | + | |
| 119 | +- **Expand all diff hunks**: {#action editor::ExpandAllDiffHunks} ({#kb editor::ExpandAllDiffHunks}) | |
| 120 | +- **Collapse all diff hunks**: Press `Escape` (bound to {#action editor::Cancel}) | |
| 121 | +- **Toggle selected diff hunks**: {#action editor::ToggleSelectedDiffHunks} ({#kb editor::ToggleSelectedDiffHunks}) | |
| 122 | +- **Navigate between hunks**: {#action editor::GoToHunk} and {#action editor::GoToPreviousHunk} | |
| 123 | + | |
| 124 | +> **Tip:** The `Escape` key is the quickest way to collapse all expanded diff hunks and return to an overview of your changes. | |
| 125 | + | |
| 115 | 126 | ## Action Reference |
| 116 | 127 | |
| 117 | −| Action | Keybinding | | |
| 118 | −| -------------------------------------- | ---------------------------------- | | |
| 119 | −| {#action git::Add} | {#kb git::Add} | | |
| 120 | −| {#action git::StageAll} | {#kb git::StageAll} | | |
| 121 | −| {#action git::UnstageAll} | {#kb git::UnstageAll} | | |
| 122 | −| {#action git::ToggleStaged} | {#kb git::ToggleStaged} | | |
| 123 | −| {#action git::StageAndNext} | {#kb git::StageAndNext} | | |
| 124 | −| {#action git::UnstageAndNext} | {#kb git::UnstageAndNext} | | |
| 125 | −| {#action git::Commit} | {#kb git::Commit} | | |
| 126 | −| {#action git::ExpandCommitEditor} | {#kb git::ExpandCommitEditor} | | |
| 127 | −| {#action git::Push} | {#kb git::Push} | | |
| 128 | −| {#action git::ForcePush} | {#kb git::ForcePush} | | |
| 129 | −| {#action git::Pull} | {#kb git::Pull} | | |
| 130 | −| {#action git::Fetch} | {#kb git::Fetch} | | |
| 131 | −| {#action git::Diff} | {#kb git::Diff} | | |
| 132 | −| {#action git::Restore} | {#kb git::Restore} | | |
| 133 | −| {#action git::RestoreFile} | {#kb git::RestoreFile} | | |
| 134 | −| {#action git::Branch} | {#kb git::Branch} | | |
| 135 | −| {#action git::Switch} | {#kb git::Switch} | | |
| 136 | −| {#action git::CheckoutBranch} | {#kb git::CheckoutBranch} | | |
| 137 | −| {#action git::Blame} | {#kb git::Blame} | | |
| 138 | −| {#action editor::ToggleGitBlameInline} | {#kb editor::ToggleGitBlameInline} | | |
| 128 | +| Action | Keybinding | | |
| 129 | +| ----------------------------------------- | ------------------------------------- | | |
| 130 | +| {#action git::Add} | {#kb git::Add} | | |
| 131 | +| {#action git::StageAll} | {#kb git::StageAll} | | |
| 132 | +| {#action git::UnstageAll} | {#kb git::UnstageAll} | | |
| 133 | +| {#action git::ToggleStaged} | {#kb git::ToggleStaged} | | |
| 134 | +| {#action git::StageAndNext} | {#kb git::StageAndNext} | | |
| 135 | +| {#action git::UnstageAndNext} | {#kb git::UnstageAndNext} | | |
| 136 | +| {#action git::Commit} | {#kb git::Commit} | | |
| 137 | +| {#action git::ExpandCommitEditor} | {#kb git::ExpandCommitEditor} | | |
| 138 | +| {#action git::Push} | {#kb git::Push} | | |
| 139 | +| {#action git::ForcePush} | {#kb git::ForcePush} | | |
| 140 | +| {#action git::Pull} | {#kb git::Pull} | | |
| 141 | +| {#action git::Fetch} | {#kb git::Fetch} | | |
| 142 | +| {#action git::Diff} | {#kb git::Diff} | | |
| 143 | +| {#action git::Restore} | {#kb git::Restore} | | |
| 144 | +| {#action git::RestoreFile} | {#kb git::RestoreFile} | | |
| 145 | +| {#action git::Branch} | {#kb git::Branch} | | |
| 146 | +| {#action git::Switch} | {#kb git::Switch} | | |
| 147 | +| {#action git::CheckoutBranch} | {#kb git::CheckoutBranch} | | |
| 148 | +| {#action git::Blame} | {#kb git::Blame} | | |
| 149 | +| {#action editor::ToggleGitBlameInline} | {#kb editor::ToggleGitBlameInline} | | |
| 150 | +| {#action editor::ExpandAllDiffHunks} | {#kb editor::ExpandAllDiffHunks} | | |
| 151 | +| {#action editor::ToggleSelectedDiffHunks} | {#kb editor::ToggleSelectedDiffHunks} | | |
| 139 | 152 | |
| 140 | 153 | > Not all actions have default keybindings, but can be bound by [customizing your keymap](./key-bindings.md#user-keymaps). |