Fix vim escape in normal mode (#2844)
Fixes: zed-industries/community#1857 - vim: Fix escape in normal mode ([#1857](https://github.com/zed-industries/community/issues/1857)).
This commit is contained in:
commit
1e3f468fc7
2 changed files with 26 additions and 0 deletions
|
@ -236,6 +236,14 @@
|
||||||
"ctrl-w ctrl-q": "pane::CloseAllItems"
|
"ctrl-w ctrl-q": "pane::CloseAllItems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// escape is in its own section so that it cancels a pending count.
|
||||||
|
"context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
|
||||||
|
"bindings": {
|
||||||
|
"escape": "editor::Cancel",
|
||||||
|
"ctrl+[": "editor::Cancel"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
|
"context": "Editor && vim_mode == normal && (vim_operator == none || vim_operator == n) && !VimWaiting",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
|
@ -389,6 +397,14 @@
|
||||||
"vim::SwitchMode",
|
"vim::SwitchMode",
|
||||||
"Normal"
|
"Normal"
|
||||||
],
|
],
|
||||||
|
"escape": [
|
||||||
|
"vim::SwitchMode",
|
||||||
|
"Normal"
|
||||||
|
],
|
||||||
|
"ctrl+[": [
|
||||||
|
"vim::SwitchMode",
|
||||||
|
"Normal"
|
||||||
|
],
|
||||||
">": "editor::Indent",
|
">": "editor::Indent",
|
||||||
"<": "editor::Outdent"
|
"<": "editor::Outdent"
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,16 @@ async fn test_escape_command_palette(cx: &mut gpui::TestAppContext) {
|
||||||
cx.assert_state("aˇbc\n", Mode::Insert);
|
cx.assert_state("aˇbc\n", Mode::Insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
async fn test_escape_cancels(cx: &mut gpui::TestAppContext) {
|
||||||
|
let mut cx = VimTestContext::new(cx, true).await;
|
||||||
|
|
||||||
|
cx.set_state("aˇbˇc", Mode::Normal);
|
||||||
|
cx.simulate_keystrokes(["escape"]);
|
||||||
|
|
||||||
|
cx.assert_state("aˇbc", Mode::Normal);
|
||||||
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_selection_on_search(cx: &mut gpui::TestAppContext) {
|
async fn test_selection_on_search(cx: &mut gpui::TestAppContext) {
|
||||||
let mut cx = VimTestContext::new(cx, true).await;
|
let mut cx = VimTestContext::new(cx, true).await;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue