Add counts to subsitute (and all)
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
e1f975e52e
commit
16022e9c1a
3 changed files with 6 additions and 2 deletions
|
@ -131,7 +131,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
|
"context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"c": [
|
"c": [
|
||||||
"vim::PushOperator",
|
"vim::PushOperator",
|
||||||
|
|
|
@ -484,7 +484,7 @@ pub fn substitute(vim: &mut Vim, count: usize, cx: &mut WindowContext) {
|
||||||
let selections = editor.selections.all::<Point>(cx);
|
let selections = editor.selections.all::<Point>(cx);
|
||||||
for selection in selections.into_iter().rev() {
|
for selection in selections.into_iter().rev() {
|
||||||
let end = if selection.start == selection.end {
|
let end = if selection.start == selection.end {
|
||||||
selection.start + Point::new(0, 1)
|
selection.start + Point::new(0, count as u32)
|
||||||
} else {
|
} else {
|
||||||
selection.end
|
selection.end
|
||||||
};
|
};
|
||||||
|
|
|
@ -117,4 +117,8 @@ async fn test_substitute(cx: &mut gpui::TestAppContext) {
|
||||||
cx.set_state(indoc! {"a«bcˇ»deˇfg\n"}, Mode::Normal);
|
cx.set_state(indoc! {"a«bcˇ»deˇfg\n"}, Mode::Normal);
|
||||||
cx.simulate_keystrokes(["s", "x"]);
|
cx.simulate_keystrokes(["s", "x"]);
|
||||||
cx.assert_editor_state("axˇdexˇg\n");
|
cx.assert_editor_state("axˇdexˇg\n");
|
||||||
|
|
||||||
|
cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
|
||||||
|
cx.simulate_keystrokes(["2", "s", "x"]);
|
||||||
|
cx.assert_editor_state("xˇc\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue