Also, allow arbitrary types to be used as Actions via the impl_actions macro Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Keith Simmons <keith@zed.dev>
19 lines
619 B
Rust
19 lines
619 B
Rust
use gpui::{actions, keymap::Binding, MutableAppContext};
|
|
|
|
actions!(
|
|
menu,
|
|
[Confirm, SelectPrev, SelectNext, SelectFirst, SelectLast,]
|
|
);
|
|
|
|
pub fn init(cx: &mut MutableAppContext) {
|
|
cx.add_bindings([
|
|
Binding::new("up", SelectPrev, Some("menu")),
|
|
Binding::new("ctrl-p", SelectPrev, Some("menu")),
|
|
Binding::new("down", SelectNext, Some("menu")),
|
|
Binding::new("ctrl-n", SelectNext, Some("menu")),
|
|
Binding::new("cmd-up", SelectFirst, Some("menu")),
|
|
Binding::new("cmd-down", SelectLast, Some("menu")),
|
|
Binding::new("enter", Confirm, Some("menu")),
|
|
]);
|
|
}
|