Add select_first and select_last bindings to outline view
Co-Authored-By: Antonio Scandurra <me@as-cii.com> Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
ea69dcd42a
commit
b7561c6cef
8 changed files with 66 additions and 47 deletions
19
crates/workspace/src/menu.rs
Normal file
19
crates/workspace/src/menu.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use gpui::{action, keymap::Binding, MutableAppContext};
|
||||
|
||||
action!(Confirm);
|
||||
action!(SelectPrev);
|
||||
action!(SelectNext);
|
||||
action!(SelectFirst);
|
||||
action!(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")),
|
||||
]);
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
pub mod menu;
|
||||
pub mod pane;
|
||||
pub mod pane_group;
|
||||
pub mod settings;
|
||||
|
@ -48,6 +49,9 @@ action!(Save);
|
|||
action!(DebugElements);
|
||||
|
||||
pub fn init(cx: &mut MutableAppContext) {
|
||||
pane::init(cx);
|
||||
menu::init(cx);
|
||||
|
||||
cx.add_global_action(open);
|
||||
cx.add_global_action(move |action: &OpenPaths, cx: &mut MutableAppContext| {
|
||||
open_paths(&action.0.paths, &action.0.app_state, cx).detach();
|
||||
|
@ -84,7 +88,6 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
None,
|
||||
),
|
||||
]);
|
||||
pane::init(cx);
|
||||
}
|
||||
|
||||
pub struct AppState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue