Detailed changes
@@ -5,9 +5,9 @@ use crate::{
use collections::HashMap;
use editor::{display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, Editor};
use gpui::{
- actions, elements::*, impl_actions, impl_internal_actions, keymap::Binding,
- platform::CursorStyle, AppContext, Entity, MutableAppContext, RenderContext, Subscription,
- Task, View, ViewContext, ViewHandle, WeakViewHandle,
+ actions, elements::*, impl_actions, impl_internal_actions, platform::CursorStyle, AppContext,
+ Entity, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext, ViewHandle,
+ WeakViewHandle,
};
use language::OffsetRangeExt;
use project::search::SearchQuery;
@@ -33,24 +33,6 @@ pub enum Event {
}
pub fn init(cx: &mut MutableAppContext) {
- cx.add_bindings([
- Binding::new(
- "cmd-f",
- Deploy { focus: true },
- Some("Editor && mode == full"),
- ),
- Binding::new(
- "cmd-e",
- Deploy { focus: false },
- Some("Editor && mode == full"),
- ),
- Binding::new("escape", Dismiss, Some("BufferSearchBar")),
- Binding::new("cmd-f", FocusEditor, Some("BufferSearchBar")),
- Binding::new("enter", SelectNextMatch, Some("BufferSearchBar")),
- Binding::new("shift-enter", SelectPrevMatch, Some("BufferSearchBar")),
- Binding::new("cmd-g", SelectNextMatch, Some("Pane")),
- Binding::new("cmd-shift-G", SelectPrevMatch, Some("Pane")),
- ]);
cx.add_action(BufferSearchBar::deploy);
cx.add_action(BufferSearchBar::dismiss);
cx.add_action(BufferSearchBar::focus_editor);
@@ -5,9 +5,9 @@ use crate::{
use collections::HashMap;
use editor::{Anchor, Autoscroll, Editor, MultiBuffer, SelectAll};
use gpui::{
- actions, elements::*, keymap::Binding, platform::CursorStyle, AppContext, ElementBox, Entity,
- ModelContext, ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View,
- ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle,
+ actions, elements::*, platform::CursorStyle, AppContext, ElementBox, Entity, ModelContext,
+ ModelHandle, MutableAppContext, RenderContext, Subscription, Task, View, ViewContext,
+ ViewHandle, WeakModelHandle, WeakViewHandle,
};
use project::{search::SearchQuery, Project};
use settings::Settings;
@@ -28,15 +28,6 @@ struct ActiveSearches(HashMap<WeakModelHandle<Project>, WeakViewHandle<ProjectSe
pub fn init(cx: &mut MutableAppContext) {
cx.set_global(ActiveSearches::default());
- cx.add_bindings([
- Binding::new("cmd-shift-F", ToggleFocus, Some("Pane")),
- Binding::new("cmd-f", ToggleFocus, Some("Pane")),
- Binding::new("cmd-shift-F", Deploy, Some("Workspace")),
- Binding::new("enter", Search, Some("ProjectSearchBar")),
- Binding::new("cmd-enter", SearchInNew, Some("ProjectSearchBar")),
- Binding::new("cmd-g", SelectNextMatch, Some("Pane")),
- Binding::new("cmd-shift-G", SelectPrevMatch, Some("Pane")),
- ]);
cx.add_action(ProjectSearchView::deploy);
cx.add_action(ProjectSearchBar::search);
cx.add_action(ProjectSearchBar::search_in_new);
@@ -40,7 +40,24 @@
"cmd-k right": [
"pane::Split",
"Right"
- ]
+ ],
+ "cmd-shift-F": "project_search::ToggleFocus",
+ "cmd-f": "project_search::ToggleFocus",
+ "cmd-g": "search::SelectNextMatch",
+ "cmd-shift-G": "search::SelectPrevMatch"
+ },
+ "Workspace": {
+ "cmd-shift-F": "project_search::Deploy"
+ },
+ "ProjectSearchBar": {
+ "enter": "project_search::Search",
+ "cmd-enter": "project_search::SearchInNew"
+ },
+ "BufferSearchBar": {
+ "escape": "buffer_search::Dismiss",
+ "cmd-f": "buffer_search::FocusEditor",
+ "enter": "search::SelectNextMatch",
+ "shift-enter": "search::SelectPrevMatch"
},
"Editor": {
"escape": "editor::Cancel",
@@ -188,7 +205,19 @@
"enter": "editor::ConfirmCodeAction"
},
"Editor && mode == full": {
- "enter": "editor::Newline"
+ "enter": "editor::Newline",
+ "cmd-f": [
+ "buffer_search::Deploy",
+ {
+ "focus": true
+ }
+ ],
+ "cmd-e": [
+ "buffer_search::Deploy",
+ {
+ "focus": false
+ }
+ ]
},
"Editor && mode == auto_height": {
"alt-enter": [