Merge d08b72b872
into 0e575b2809
This commit is contained in:
commit
4724e77a86
6 changed files with 169 additions and 17 deletions
|
@ -44,6 +44,7 @@ settings.workspace = true
|
|||
task.workspace = true
|
||||
text.workspace = true
|
||||
theme.workspace = true
|
||||
menu.workspace = true
|
||||
tokio = { version = "1.15", features = ["full"], optional = true }
|
||||
ui.workspace = true
|
||||
util.workspace = true
|
||||
|
|
|
@ -222,6 +222,8 @@ actions!(
|
|||
PushReplaceWithRegister,
|
||||
/// Toggles comments.
|
||||
PushToggleComments,
|
||||
MenuSelectNext,
|
||||
MenuSelectPrevious
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -251,6 +253,47 @@ pub fn init(cx: &mut App) {
|
|||
})
|
||||
});
|
||||
|
||||
workspace.register_action(|_, _: &MenuSelectNext, window, cx| {
|
||||
let count = Vim::take_count(cx).unwrap_or(1);
|
||||
|
||||
for _ in 0..count {
|
||||
window.dispatch_action(menu::SelectNext.boxed_clone(), cx);
|
||||
}
|
||||
});
|
||||
|
||||
workspace.register_action(|_, _: &MenuSelectPrevious, window, cx| {
|
||||
let count = Vim::take_count(cx).unwrap_or(1);
|
||||
|
||||
for _ in 0..count {
|
||||
window.dispatch_action(menu::SelectPrevious.boxed_clone(), cx);
|
||||
}
|
||||
});
|
||||
|
||||
workspace.register_action(|workspace, n: &Number, window, cx| {
|
||||
let vim = workspace
|
||||
.focused_pane(window, cx)
|
||||
.read(cx)
|
||||
.active_item()
|
||||
.and_then(|item| item.act_as::<Editor>(cx))
|
||||
.and_then(|editor| editor.read(cx).addon::<VimAddon>().cloned());
|
||||
if let Some(vim) = vim {
|
||||
let digit = n.0;
|
||||
vim.entity.update(cx, |_, cx| {
|
||||
cx.defer_in(window, move |vim, window, cx| {
|
||||
vim.push_count_digit(digit, window, cx)
|
||||
})
|
||||
});
|
||||
} else {
|
||||
let count = Vim::globals(cx).pre_count.unwrap_or(0);
|
||||
Vim::globals(cx).pre_count = Some(
|
||||
count
|
||||
.checked_mul(10)
|
||||
.and_then(|c| c.checked_add(n.0))
|
||||
.unwrap_or(count),
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
workspace.register_action(|_, _: &OpenDefaultKeymap, _, cx| {
|
||||
cx.emit(workspace::Event::OpenBundledFile {
|
||||
text: settings::vim_keymap(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue