Load modal key bindings from JSON file
This commit is contained in:
parent
1e2eeaa22a
commit
b4babbeeaa
6 changed files with 34 additions and 50 deletions
|
@ -1,12 +1,8 @@
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
use fuzzy::PathMatch;
|
use fuzzy::PathMatch;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions, elements::*, impl_internal_actions, keymap, AppContext, Axis, Entity, ModelHandle,
|
||||||
elements::*,
|
MutableAppContext, RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||||
impl_internal_actions,
|
|
||||||
keymap::{self, Binding},
|
|
||||||
AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View,
|
|
||||||
ViewContext, ViewHandle, WeakViewHandle,
|
|
||||||
};
|
};
|
||||||
use project::{Project, ProjectPath, WorktreeId};
|
use project::{Project, ProjectPath, WorktreeId};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
|
@ -50,11 +46,6 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(FileFinder::select);
|
cx.add_action(FileFinder::select);
|
||||||
cx.add_action(FileFinder::select_prev);
|
cx.add_action(FileFinder::select_prev);
|
||||||
cx.add_action(FileFinder::select_next);
|
cx.add_action(FileFinder::select_next);
|
||||||
|
|
||||||
cx.add_bindings(vec![
|
|
||||||
Binding::new("cmd-p", Toggle, None),
|
|
||||||
Binding::new("escape", Toggle, Some("FileFinder")),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use editor::{display_map::ToDisplayPoint, Autoscroll, DisplayPoint, Editor};
|
use editor::{display_map::ToDisplayPoint, Autoscroll, DisplayPoint, Editor};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity,
|
actions, elements::*, geometry::vector::Vector2F, Axis, Entity, MutableAppContext,
|
||||||
MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
|
RenderContext, View, ViewContext, ViewHandle,
|
||||||
};
|
};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use text::{Bias, Point};
|
use text::{Bias, Point};
|
||||||
|
@ -10,11 +10,6 @@ use workspace::Workspace;
|
||||||
actions!(go_to_line, [Toggle, Confirm]);
|
actions!(go_to_line, [Toggle, Confirm]);
|
||||||
|
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_bindings([
|
|
||||||
Binding::new("ctrl-g", Toggle, Some("Editor")),
|
|
||||||
Binding::new("escape", Toggle, Some("GoToLine")),
|
|
||||||
Binding::new("enter", Confirm, Some("GoToLine")),
|
|
||||||
]);
|
|
||||||
cx.add_action(GoToLine::toggle);
|
cx.add_action(GoToLine::toggle);
|
||||||
cx.add_action(GoToLine::confirm);
|
cx.add_action(GoToLine::confirm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,8 @@ use editor::{
|
||||||
};
|
};
|
||||||
use fuzzy::StringMatch;
|
use fuzzy::StringMatch;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions, elements::*, geometry::vector::Vector2F, keymap, AppContext, Axis, Entity,
|
||||||
elements::*,
|
MutableAppContext, RenderContext, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||||
geometry::vector::Vector2F,
|
|
||||||
keymap::{self, Binding},
|
|
||||||
AppContext, Axis, Entity, MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
|
|
||||||
WeakViewHandle,
|
|
||||||
};
|
};
|
||||||
use language::Outline;
|
use language::Outline;
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
|
@ -23,10 +19,6 @@ use workspace::{
|
||||||
actions!(outline, [Toggle]);
|
actions!(outline, [Toggle]);
|
||||||
|
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_bindings([
|
|
||||||
Binding::new("cmd-shift-O", Toggle, Some("Editor")),
|
|
||||||
Binding::new("escape", Toggle, Some("OutlineView")),
|
|
||||||
]);
|
|
||||||
cx.add_action(OutlineView::toggle);
|
cx.add_action(OutlineView::toggle);
|
||||||
cx.add_action(OutlineView::confirm);
|
cx.add_action(OutlineView::confirm);
|
||||||
cx.add_action(OutlineView::select_prev);
|
cx.add_action(OutlineView::select_prev);
|
||||||
|
|
|
@ -3,11 +3,8 @@ use editor::{
|
||||||
};
|
};
|
||||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions, elements::*, keymap, AppContext, Axis, Entity, ModelHandle, MutableAppContext,
|
||||||
elements::*,
|
RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||||
keymap::{self, Binding},
|
|
||||||
AppContext, Axis, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View,
|
|
||||||
ViewContext, ViewHandle, WeakViewHandle,
|
|
||||||
};
|
};
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use project::{Project, Symbol};
|
use project::{Project, Symbol};
|
||||||
|
@ -25,10 +22,6 @@ use workspace::{
|
||||||
actions!(project_symbols, [Toggle]);
|
actions!(project_symbols, [Toggle]);
|
||||||
|
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_bindings([
|
|
||||||
Binding::new("cmd-t", Toggle, None),
|
|
||||||
Binding::new("escape", Toggle, Some("ProjectSymbolsView")),
|
|
||||||
]);
|
|
||||||
cx.add_action(ProjectSymbolsView::toggle);
|
cx.add_action(ProjectSymbolsView::toggle);
|
||||||
cx.add_action(ProjectSymbolsView::confirm);
|
cx.add_action(ProjectSymbolsView::confirm);
|
||||||
cx.add_action(ProjectSymbolsView::select_prev);
|
cx.add_action(ProjectSymbolsView::select_prev);
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
|
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions, elements::*, keymap, AppContext, Axis, Element, ElementBox, Entity, MutableAppContext,
|
||||||
elements::*,
|
RenderContext, View, ViewContext, ViewHandle,
|
||||||
keymap::{self, Binding},
|
|
||||||
AppContext, Axis, Element, ElementBox, Entity, MutableAppContext, RenderContext, View,
|
|
||||||
ViewContext, ViewHandle,
|
|
||||||
};
|
};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use std::{cmp, sync::Arc};
|
use std::{cmp, sync::Arc};
|
||||||
|
@ -33,12 +30,6 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(ThemeSelector::select_next);
|
cx.add_action(ThemeSelector::select_next);
|
||||||
cx.add_action(ThemeSelector::toggle);
|
cx.add_action(ThemeSelector::toggle);
|
||||||
cx.add_action(ThemeSelector::reload);
|
cx.add_action(ThemeSelector::reload);
|
||||||
|
|
||||||
cx.add_bindings(vec![
|
|
||||||
Binding::new("cmd-k cmd-t", Toggle, None),
|
|
||||||
Binding::new("cmd-k t", Reload, None),
|
|
||||||
Binding::new("escape", Toggle, Some("ThemeSelector")),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
|
|
|
@ -47,7 +47,11 @@
|
||||||
"cmd-shift-G": "search::SelectPrevMatch"
|
"cmd-shift-G": "search::SelectPrevMatch"
|
||||||
},
|
},
|
||||||
"Workspace": {
|
"Workspace": {
|
||||||
"cmd-shift-F": "project_search::Deploy"
|
"cmd-shift-F": "project_search::Deploy",
|
||||||
|
"cmd-k cmd-t": "theme_selector::Toggle",
|
||||||
|
"cmd-k t": "theme_selector::Reload",
|
||||||
|
"cmd-t": "project_symbols::Toggle",
|
||||||
|
"cmd-p": "file_finder::Toggle"
|
||||||
},
|
},
|
||||||
"ProjectSearchBar": {
|
"ProjectSearchBar": {
|
||||||
"enter": "project_search::Search",
|
"enter": "project_search::Search",
|
||||||
|
@ -217,12 +221,30 @@
|
||||||
{
|
{
|
||||||
"focus": false
|
"focus": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"cmd-shift-O": "outline::Toggle",
|
||||||
|
"ctrl-g": "go_to_line::Toggle"
|
||||||
},
|
},
|
||||||
"Editor && mode == auto_height": {
|
"Editor && mode == auto_height": {
|
||||||
"alt-enter": [
|
"alt-enter": [
|
||||||
"editor::Input",
|
"editor::Input",
|
||||||
"\n"
|
"\n"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"OutlineView": {
|
||||||
|
"escape": "outline::Toggle"
|
||||||
|
},
|
||||||
|
"ProjectSymbolsView": {
|
||||||
|
"escape": "project_symbols::Toggle"
|
||||||
|
},
|
||||||
|
"ThemeSelector": {
|
||||||
|
"escape": "theme_selector::Toggle"
|
||||||
|
},
|
||||||
|
"GoToLine": {
|
||||||
|
"escape": "go_to_line::Toggle",
|
||||||
|
"enter": "go_to_line::Confirm"
|
||||||
|
},
|
||||||
|
"FileFinder": {
|
||||||
|
"escape": "file_finder::Toggle"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue