History

editor: Add CollapseAllDiffHunks docs (#34124)

## 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

Kristian Gosvig committed 1 year ago

Commit e2b9dfa1 parent 495ec7a1 file · +35 −22Browse files

Unified · Split

docs/src/git.md+35−22
@@ -112,29 +112,42 @@ by creating a [custom key bindings](key-bindings.md#custom-key-bindings) to the · 111 unmodified lines
112`editor::CopyPermalinkToLine` or `editor::OpenPermalinkToLine` actions112`editor::CopyPermalinkToLine` or `editor::OpenPermalinkToLine` actions
113or by simply right clicking and selecting `Copy Permalink` with line(s) selected in your editor.113or by simply right clicking and selecting `Copy Permalink` with line(s) selected in your editor.
114 114
115## Diff Hunk Keyboard Shortcuts
116
117When 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## Action Reference126## Action Reference
116 127
117| Action | Keybinding |128| Action | Keybinding |
118| -------------------------------------- | ---------------------------------- |129| ----------------------------------------- | ------------------------------------- |
119| {#action git::Add} | {#kb git::Add} |130| {#action git::Add} | {#kb git::Add} |
120| {#action git::StageAll} | {#kb git::StageAll} |131| {#action git::StageAll} | {#kb git::StageAll} |
121| {#action git::UnstageAll} | {#kb git::UnstageAll} |132| {#action git::UnstageAll} | {#kb git::UnstageAll} |
122| {#action git::ToggleStaged} | {#kb git::ToggleStaged} |133| {#action git::ToggleStaged} | {#kb git::ToggleStaged} |
123| {#action git::StageAndNext} | {#kb git::StageAndNext} |134| {#action git::StageAndNext} | {#kb git::StageAndNext} |
124| {#action git::UnstageAndNext} | {#kb git::UnstageAndNext} |135| {#action git::UnstageAndNext} | {#kb git::UnstageAndNext} |
125| {#action git::Commit} | {#kb git::Commit} |136| {#action git::Commit} | {#kb git::Commit} |
126| {#action git::ExpandCommitEditor} | {#kb git::ExpandCommitEditor} |137| {#action git::ExpandCommitEditor} | {#kb git::ExpandCommitEditor} |
127| {#action git::Push} | {#kb git::Push} |138| {#action git::Push} | {#kb git::Push} |
128| {#action git::ForcePush} | {#kb git::ForcePush} |139| {#action git::ForcePush} | {#kb git::ForcePush} |
129| {#action git::Pull} | {#kb git::Pull} |140| {#action git::Pull} | {#kb git::Pull} |
130| {#action git::Fetch} | {#kb git::Fetch} |141| {#action git::Fetch} | {#kb git::Fetch} |
131| {#action git::Diff} | {#kb git::Diff} |142| {#action git::Diff} | {#kb git::Diff} |
132| {#action git::Restore} | {#kb git::Restore} |143| {#action git::Restore} | {#kb git::Restore} |
133| {#action git::RestoreFile} | {#kb git::RestoreFile} |144| {#action git::RestoreFile} | {#kb git::RestoreFile} |
134| {#action git::Branch} | {#kb git::Branch} |145| {#action git::Branch} | {#kb git::Branch} |
135| {#action git::Switch} | {#kb git::Switch} |146| {#action git::Switch} | {#kb git::Switch} |
136| {#action git::CheckoutBranch} | {#kb git::CheckoutBranch} |147| {#action git::CheckoutBranch} | {#kb git::CheckoutBranch} |
137| {#action git::Blame} | {#kb git::Blame} |148| {#action git::Blame} | {#kb git::Blame} |
138| {#action editor::ToggleGitBlameInline} | {#kb editor::ToggleGitBlameInline} |149| {#action editor::ToggleGitBlameInline} | {#kb editor::ToggleGitBlameInline} |
150| {#action editor::ExpandAllDiffHunks} | {#kb editor::ExpandAllDiffHunks} |
151| {#action editor::ToggleSelectedDiffHunks} | {#kb editor::ToggleSelectedDiffHunks} |
139 152
140> Not all actions have default keybindings, but can be bound by [customizing your keymap](./key-bindings.md#user-keymaps).153> Not all actions have default keybindings, but can be bound by [customizing your keymap](./key-bindings.md#user-keymaps).

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t