# git_ui: Fix branch picker stealing vim keys in Git panel \(\#52687\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7315aada89c44e74cd08c31ecf168a1ce8322242

Requested commit: 7315aada89c44e74cd08c31ecf168a1ce8322242

Commit: 7315aada89c44e74cd08c31ecf168a1ce8322242

Tree: a64b55e315e9bf5c3146c49f68de6df93d142cf6

Author: saberoueslati

Committer: GitHub

## Message

```
git_ui: Fix branch picker stealing vim keys in Git panel (#52687)

## Context

When `vim_mode` is enabled, opening the branch selector popover in the
Git panel and pressing `i`, `j`, `k`, or `x` triggered Git panel actions
(`FocusEditor`, `SelectNext`, `ToggleStaged`, etc.) instead of reaching
the picker's search field.

The `"GitPanel && ChangesList"` keybinding block in `vim.json` matched
whenever _any_ child of the git panel's focus handle was focused —
including the branch picker popover — because
`GitPanel::dispatch_context()` adds `ChangesList` based on
`focus_handle.contains_focused()`, which is true for all children, not
just the changes list itself.

The branch picker's root element already sets
`.key_context("GitBranchSelector")` (branch_picker.rs). GPUI's `Not`
predicate evaluates against the entire context path, so adding `&&
!GitBranchSelector` to the block's context suppresses all those bindings
whenever the picker is open, and restores them exactly as before once
it's closed.

Closes #52617

Video of the manual test of the fix below :

[Screencast from 2026-03-29
22-01-11.webm](https://github.com/user-attachments/assets/217e8e31-9bee-4e77-a7aa-0c094874ed9a)

## How to Review

- `assets/keymaps/vim.json` : changed the `"GitPanel && ChangesList"`
context string ,I added`&& !GitBranchSelector`.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed branch picker in the Git panel stealing vim keystrokes (`i`,
`j`, `k`, `x`) when vim mode is enabled
```

## Parents

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

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