keymap: Update Prev
to Previous
follow-up (#25931)
Follow-up for https://github.com/zed-industries/zed/pull/25909 Add three more action replacements: ``` 1. "pane::ActivatePrevItem" -> "pane::ActivatePreviousItem" 2. "vim::MoveToPrev" -> "vim::MoveToPrevious" 3. "vim:MoveToPrevMatch" -> "vim:MoveToPreviousMatch" ``` Release Notes: - N/A
This commit is contained in:
parent
466be14b56
commit
8bb2739e28
12 changed files with 42 additions and 34 deletions
|
@ -482,6 +482,9 @@ static STRING_REPLACE: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
|
|||
("file_finder::SelectPrev", "file_finder::SelectPrevious"),
|
||||
("menu::SelectPrev", "menu::SelectPrevious"),
|
||||
("editor::TabPrev", "editor::Backtab"),
|
||||
("pane::ActivatePrevItem", "pane::ActivatePreviousItem"),
|
||||
("vim::MoveToPrev", "vim::MoveToPrevious"),
|
||||
("vim::MoveToPrevMatch", "vim::MoveToPreviousMatch"),
|
||||
])
|
||||
});
|
||||
|
||||
|
|
|
@ -784,8 +784,8 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
|||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(("bn", "ext"), workspace::ActivateNextItem).count(),
|
||||
VimCommand::new(("bN", "ext"), workspace::ActivatePrevItem).count(),
|
||||
VimCommand::new(("bp", "revious"), workspace::ActivatePrevItem).count(),
|
||||
VimCommand::new(("bN", "ext"), workspace::ActivatePreviousItem).count(),
|
||||
VimCommand::new(("bp", "revious"), workspace::ActivatePreviousItem).count(),
|
||||
VimCommand::new(("bf", "irst"), workspace::ActivateItem(0)),
|
||||
VimCommand::new(("br", "ewind"), workspace::ActivateItem(0)),
|
||||
VimCommand::new(("bl", "ast"), workspace::ActivateLastItem),
|
||||
|
@ -794,8 +794,8 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
|||
VimCommand::new(("tabe", "dit"), workspace::NewFile),
|
||||
VimCommand::new(("tabnew", ""), workspace::NewFile),
|
||||
VimCommand::new(("tabn", "ext"), workspace::ActivateNextItem).count(),
|
||||
VimCommand::new(("tabp", "revious"), workspace::ActivatePrevItem).count(),
|
||||
VimCommand::new(("tabN", "ext"), workspace::ActivatePrevItem).count(),
|
||||
VimCommand::new(("tabp", "revious"), workspace::ActivatePreviousItem).count(),
|
||||
VimCommand::new(("tabN", "ext"), workspace::ActivatePreviousItem).count(),
|
||||
VimCommand::new(
|
||||
("tabc", "lose"),
|
||||
workspace::CloseActiveItem {
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(crate) struct MoveToNext {
|
|||
|
||||
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(crate) struct MoveToPrev {
|
||||
pub(crate) struct MoveToPrevious {
|
||||
#[serde(default = "default_true")]
|
||||
case_sensitive: bool,
|
||||
#[serde(default)]
|
||||
|
@ -67,15 +67,15 @@ pub(crate) struct Replacement {
|
|||
is_case_sensitive: bool,
|
||||
}
|
||||
|
||||
actions!(vim, [SearchSubmit, MoveToNextMatch, MoveToPrevMatch]);
|
||||
impl_actions!(vim, [FindCommand, Search, MoveToPrev, MoveToNext]);
|
||||
actions!(vim, [SearchSubmit, MoveToNextMatch, MoveToPreviousMatch]);
|
||||
impl_actions!(vim, [FindCommand, Search, MoveToPrevious, MoveToNext]);
|
||||
impl_internal_actions!(vim, [ReplaceCommand]);
|
||||
|
||||
pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
||||
Vim::action(editor, cx, Vim::move_to_next);
|
||||
Vim::action(editor, cx, Vim::move_to_prev);
|
||||
Vim::action(editor, cx, Vim::move_to_previous);
|
||||
Vim::action(editor, cx, Vim::move_to_next_match);
|
||||
Vim::action(editor, cx, Vim::move_to_prev_match);
|
||||
Vim::action(editor, cx, Vim::move_to_previous_match);
|
||||
Vim::action(editor, cx, Vim::search);
|
||||
Vim::action(editor, cx, Vim::search_deploy);
|
||||
Vim::action(editor, cx, Vim::find_command);
|
||||
|
@ -94,7 +94,12 @@ impl Vim {
|
|||
)
|
||||
}
|
||||
|
||||
fn move_to_prev(&mut self, action: &MoveToPrev, window: &mut Window, cx: &mut Context<Self>) {
|
||||
fn move_to_previous(
|
||||
&mut self,
|
||||
action: &MoveToPrevious,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
self.move_to_internal(
|
||||
Direction::Prev,
|
||||
action.case_sensitive,
|
||||
|
@ -114,9 +119,9 @@ impl Vim {
|
|||
self.move_to_match_internal(self.search.direction, window, cx)
|
||||
}
|
||||
|
||||
fn move_to_prev_match(
|
||||
fn move_to_previous_match(
|
||||
&mut self,
|
||||
_: &MoveToPrevMatch,
|
||||
_: &MoveToPreviousMatch,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
|
|
|
@ -172,7 +172,7 @@ impl_actions!(
|
|||
actions!(
|
||||
pane,
|
||||
[
|
||||
ActivatePrevItem,
|
||||
ActivatePreviousItem,
|
||||
ActivateNextItem,
|
||||
ActivateLastItem,
|
||||
AlternateFile,
|
||||
|
@ -3203,7 +3203,7 @@ impl Render for Pane {
|
|||
}),
|
||||
)
|
||||
.on_action(
|
||||
cx.listener(|pane: &mut Pane, _: &ActivatePrevItem, window, cx| {
|
||||
cx.listener(|pane: &mut Pane, _: &ActivatePreviousItem, window, cx| {
|
||||
pane.activate_prev_item(true, window, cx);
|
||||
}),
|
||||
)
|
||||
|
|
|
@ -3884,7 +3884,7 @@ mod tests {
|
|||
// From the Atom keymap
|
||||
use workspace::ActivatePreviousPane;
|
||||
// From the JetBrains keymap
|
||||
use workspace::ActivatePrevItem;
|
||||
use workspace::ActivatePreviousItem;
|
||||
|
||||
app_state
|
||||
.fs
|
||||
|
@ -3925,7 +3925,7 @@ mod tests {
|
|||
workspace.register_action(|_, _: &A, _window, _cx| {});
|
||||
workspace.register_action(|_, _: &B, _window, _cx| {});
|
||||
workspace.register_action(|_, _: &ActivatePreviousPane, _window, _cx| {});
|
||||
workspace.register_action(|_, _: &ActivatePrevItem, _window, _cx| {});
|
||||
workspace.register_action(|_, _: &ActivatePreviousItem, _window, _cx| {});
|
||||
cx.notify();
|
||||
})
|
||||
.unwrap();
|
||||
|
@ -3974,7 +3974,7 @@ mod tests {
|
|||
assert_key_bindings_for(
|
||||
workspace.into(),
|
||||
cx,
|
||||
vec![("backspace", &B), ("{", &ActivatePrevItem)],
|
||||
vec![("backspace", &B), ("{", &ActivatePreviousItem)],
|
||||
line!(),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue