Vim: Multiple insert with <Esc> keybinding only inserts once

Created on 24 Dec 2017  路  3Comments  路  Source: VSCodeVim/Vim

  • Click thumbs-up 馃憤 on this issue if you want it!
  • Click confused 馃槙 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Is this a BUG REPORT or FEATURE REQUEST? (choose one):

Environment:

  • VSCode Version: 1.19.1
  • VsCodeVim Version: 0.10.6
  • OS: macOS 10.12.6

What happened:

I have the key sequence jk mapped to escape in insert mode, but this causes multiple inserts to only insert once when I exit insert mode using jk. For example, the key sequence 3i=jk on an empty document produces only:

=

What did you expect to happen:

In vim, and using the plain old escape key, 3i=<Esc> on an empty document produces:

===

How to reproduce it:

Bind jk to <Esc> in insert mode:

"vim.insertModeKeyBindings": [
    {
        "before": ["j", "k"],
        "after": ["<Esc>"]
    }
],
areremap kinbug

Most helpful comment

@J-Fields I can try to handle this one.

All 3 comments

I've dug around in the source code a bit and it seems like this is happening because only <Esc>, rather than i=<Esc>, is being handled count times in the Remapper.sendKey() method in src/configuration/remapper.ts (looks like there's a pending pull request to refactor that file, so this might change). I'd love to help out with this, but I'm not sure of the scale of the refactoring that would be needed to do this (also can't figure out how to implement tests for the extension's handling of keybindings - I can't find any examples of that). I'll keep looking into this, but in the meantime, any advice would be appreciated. Thanks for all your work on a great extension!

Any news about this bug?

@J-Fields I can try to handle this one.

Was this page helpful?
0 / 5 - 0 ratings