# editor: Add \`diffs_expanded\` to key context when diff hunks are expanded \(\#40617\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/3de3a369f502ec5f802ea64a1c3f190269870c2d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 3de3a369f502ec5f802ea64a1c3f190269870c2d

Requested commit: 3de3a369f502ec5f802ea64a1c3f190269870c2d

Commit: 3de3a369f502ec5f802ea64a1c3f190269870c2d

Tree: 150ae3a3724596eafb8d26ab5e2d3497aa764d6f

Author: Josh Piasecki

Committer: GitHub

## Message

````
editor: Add `diffs_expanded` to key context when diff hunks are expanded (#40617)

including a new identifier on the Editor key context will allow for some
more flexibility when creating keybindings.

for example i would like to be able to set the following:
```json
{
  "context": "Editor",
  "bindings": {
    "pageup": ["editor::MovePageUp", { "center_cursor": true }],
    "pagedown": ["editor::MovePageDown", { "center_cursor": true }],
  }
},
{
  "context": "Editor && diffs_expanded",
  "bindings": {
    "pageup": "editor::GoToPrevHunk",
    "pagedown": "editor::GoToHunk",
  }
},
```

<img width="1392" height="1167" alt="Screenshot 2025-10-18 at 23 51 46"
src="https://github.com/user-attachments/assets/cf4e262e-97e7-4dd9-bbda-cd272770f1ac"
/>


very open to suggestions for the name. that's the best i could come up
with.

the action *IS* called `editor::ExpandAllDiffHunks` so this seems
fitting.

the identifier is included if *any* diff hunk is visible, even if some
of them have been closed using `editor::ToggleSelectedDiffHunk`


Release Notes:

- The Editor key context now includes 'diffs_expanded' when diff changes
are visible
````

## Parents

- [28a0b826180eb7b772469b1c8e147971a0982e43](https://git.cafe/gitcafe/zed/commit/28a0b826180eb7b772469b1c8e147971a0982e43?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/3de3a369f502ec5f802ea64a1c3f190269870c2d?format=markdown)
