zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.9k stars 2.69k forks source link

Exiting VIM insert mode requires pressing [Escape] two or three times after a LSP completion has been accepted #16553

Open isdampe opened 3 weeks ago

isdampe commented 3 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

In VIM's insert mode, after the user accepts an autocomplete suggestion from a language server (by selecting an entry and pressing [Return]), the user must press the escape binding multiple times to get back into normal mode

Steps to reproduce

  1. Turn on VIM mode
  2. Enter insert mode [i]
  3. Start typing to trigger language server auto complete panel
  4. Select a suggestion and press [Return]
  5. Attempt to leave insert mode and go back to normal mode [Escape]
  6. Observe that the first press doesn't take the editor back into normal mode
  7. Press [Escape] again until it works

Environment

Zed: v0.149.3 (Zed) OS: macOS 14.3.1 Memory: 24 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

isdampe commented 3 weeks ago

Hacky work around using key map

  {
    "context": "vim_mode == insert",
    "bindings": {
        "ctrl-;": "vim::NormalBefore",
        "ctrl-'": ["vim::SwitchMode", "Normal"],
        "escape": ["workspace::SendKeystrokes", "ctrl-; ctrl-'"]
    }
  }
ConradIrwin commented 3 weeks ago

@isdampe I can't reproduce this. Do you have anything in your settings or keybindings that might be getting in the way?

For me, even if the completion menu is open, escape puts me back in normal mode.