# gpui: Add keybind metadata API \(\#33316\) · gitcafe/zed

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

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

Visibility: public

Requested revision: deb2564b31880f2a02f5d9557962293d016e33d3

Requested commit: deb2564b31880f2a02f5d9557962293d016e33d3

Commit: deb2564b31880f2a02f5d9557962293d016e33d3

Tree: 91a56537fd85e290ebd24c8c29be29a6e2d66d69

Author: Ben Kunkle

Committer: GitHub

## Message

```
gpui: Add keybind metadata API (#33316)

Closes #ISSUE

Adds a very simple API to track metadata about keybindings in GPUI,
namely the source of the binding. The motivation for this is displaying
the source of keybindings in the [keymap
UI](https://github.com/zed-industries/zed/pull/32436).

The API is designed to be as simple and flexible as possible, storing
only a `Option<u32>` on the bindings themselves to keep the struct
small. It is intended to be used as an index or key into a table/map
created and managed by the consumer of the API to map from indices to
arbitrary meta-data. I.e. the consumer is responsible for both
generating these indices and giving them meaning.

The current usage in Zed is stateless, just a mapping between constants
and User, Default, Base, and Vim keymap sources, however, this can be
extended in the future to also track _which_ base keymap is being used.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
```

## Parents

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

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