vim: indent/outdent

Fixes: zed-industries/community#832
This commit is contained in:
Conrad Irwin 2023-06-26 10:08:34 -06:00
parent 3f4a06f576
commit c3e8cae20f
2 changed files with 22 additions and 2 deletions

View File

@ -221,7 +221,9 @@
"vim::PushOperator",
"Replace"
],
"s": "vim::Substitute"
"s": "vim::Substitute",
"> >": "editor::Indent",
"< <": "editor::Outdent"
}
},
{
@ -312,7 +314,9 @@
"r": [
"vim::PushOperator",
"Replace"
]
],
"> >": "editor::Indent",
"< <": "editor::Outdent"
}
},
{

View File

@ -123,3 +123,19 @@ async fn test_end_of_document_710(cx: &mut gpui::TestAppContext) {
cx.simulate_keystrokes(["1", "shift-g"]);
cx.assert_editor_state("aˇa\nbb\ncc");
}
#[gpui::test]
async fn test_indent_outdent(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// works in normal mode
cx.set_state(indoc! {"aa\nbˇb\ncc"}, Mode::Normal);
cx.simulate_keystrokes([">", ">"]);
cx.assert_editor_state("aa\n bˇb\ncc");
cx.simulate_keystrokes(["<", "<"]);
cx.assert_editor_state("aa\nbˇb\ncc");
// works in visuial mode
cx.simulate_keystrokes(["shift-v", "down", ">", ">"]);
cx.assert_editor_state("aa\n b«b\n cˇ»c");
}