johtela / vscode-modaledit

Configurable Modal Editing in VS Code
https://johtela.github.io/vscode-modaledit/docs/README.html
Other
89 stars 8 forks source link

How to properly abort a command using the `escape` key? #40

Open digitalmaster opened 1 week ago

digitalmaster commented 1 week ago

I'm trying to figure out how to get my escape key to reliably get me back to the initial state (normal mode, canceled any ongoing key chords).

The issue i'm facing now is that if I start typing a command like vi and decide that I no longer want to complete this sequence, hitting escape gets me out of visual mode but it doesn't abort the ongoing key chord.

I've looked through docs and examples but haven't been able to find a way to do this yet. Curious if there's an obvious way to do this?

Sidenote: The first issue I had with the escape key is that sometimes I had to press it multiple times to get back normal mode. I thought this a was a bug but then realized it was only happening when there was a suggestion visible. So first press would dismiss the suggestion, second press would put me back into normal mode. The escape key binding confirmed this behavior:

{
    "key": "escape",
    "command": "modaledit.enterNormal",
    "when": "editorTextFocus && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},

Once I realized that I just hit escape until I get the normal mode block cursor which works well for me.