Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting ESC in insert mode with a search selection does not exit insert mode #242

Open
jleclanche opened this issue Oct 18, 2018 · 3 comments

Comments

@jleclanche
Copy link

Reproduce in a file by entering /foo, then entering insert mode, then hitting ESC to attempt exiting insert mode.

@bytemain
Copy link

bytemain commented Aug 11, 2020

you can use another key binding to map command

like:

  {
    "key": "ctrl+j",
    "command": "amVim.escape"
  },
  {
    "key": "escape",
    "command": "amVim.escape",
    "when": "!parameterHintsVisible && !suggestWidgetVisible && !editorHasMultipleSelections && !findWidgetVisible && !renameInputVisible"
  },

@alisonatwork
Copy link
Collaborator

alisonatwork commented Nov 1, 2022

This can be solved with the override:

    {
        "key": "escape",
        "command": "amVim.escape",
        "when": "amVim.mode == 'INSERT' && editorFocus && findWidgetVisible && !isComposing"
    },

I feel like this perhaps should be the standard behavior, so I will add it to the list of stuff to do for the next release.

@alisonatwork
Copy link
Collaborator

For reference: in 96cb3f5 we started redeclaring the default escape keybindings in our own package.json, to avoid the amVim escape from hijacking built-in escape behavior. Since that commit dozens of new escape keybindings have been added, so it's not really going to be sustainable to keep copying them all into package.json. In most cases, amVim seems to do the right thing anyway, either because the binding isn't something that happens inside the editor window, or because of the change in 57048be which explicitly closes some of the expected things when you press escape.

Perhaps we should remove all the overrides from package.json that don't appear to conflict with the default escape and then slowly add back only the ones that have an unexpected behavior. In case of find widget, it makes sense for the first escape to switch to normal mode, and only then the second escape closes the widget (if it's open).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants