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

Using single 'q' character for <ESC> binding in Insert mode removes the last typed character #1076

Closed
alexeygrant opened this issue Nov 22, 2016 · 6 comments

Comments

@alexeygrant
Copy link

alexeygrant commented Nov 22, 2016

Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

In vim/VsVim I bind 'q' to <ESC> in the insert mode. Therefore I've configured this binding:
"vim.insertModeKeyBindingsNonRecursive": [
{
"before": ["q"],
"after": [""]
}
]
Put the exact keys you pressed.
Type anything in Insert mode, then press 'q'

What did you expect to happen?

Pressing 'q' would exit Insert mode.

What happened instead?

Pressing 'q' removes the last typed character and then exits Insert mode (exactly as if press ESC).

Technical details:

  • VSCode Version: 1.7.1
  • VsCodeVim Version: 0.4.3
  • OS: Windows 10 x64
@xconverge
Copy link
Member

@alexeygrant Thanks for reporting this!

A temporary workaround until we fix this:

If you have any other mappings that use 2 keys, if you remove them, this one will work fine.

For example, I can reproduce this if I have jj mapped to AND q mapped to , jj then works correctly but q removes the extra char. If I have ONLY q mapped to it works correctly.

This has to do with _longestKeySequence() being checked in remapper.ts

@xconverge
Copy link
Member

I had to type "sequence" to fix this. I kept messing it all up because I would type se q (exit insert) u (undo my change) and it took me 3 times of that to realize that I had added this q to esc binding to debug this issue 😆

@alexeygrant
Copy link
Author

alexeygrant commented Nov 22, 2016

Yes, indeed, I had another binding - "zz" to "q" in the insert mode :). Thanks for the workaround, I'll survive for some time.
Any timeframes when it will be fixed?

@xconverge
Copy link
Member

I have a pull request out so it should be in the next release!

@alexeygrant
Copy link
Author

Hmm, I didn't realise the fix was there for some time already :). It now works fine with a single character mapping to to ESC. Thanks a lot.

@xconverge
Copy link
Member

No problem!

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

No branches or pull requests

2 participants