Vim: Wrong cursor position entering normal mode

Created on 21 Mar 2017  路  5Comments  路  Source: VSCodeVim/Vim

What did you do?

Add this to config:

 "vim.insertModeKeyBindings": [
        {
            "before": [
                "d",
                "f"
            ],
            "after": [
                "<Esc>"
            ]
        }
    ]

What did you expect to happen?

to work keys same as in vim and same as

What happened instead?

put cursor in the middle of text and press df, it enters normal mode, but places cursor one position further than

Technical details:

  • VSCode Version: 1.10.2
  • VsCodeVim Version: 0.6.11
  • OS: macOS
areremap kinbug

Most helpful comment

This must be because I reverse the keystrokes but don't reverse the cursor position.

I think the correct way to do this would be to record where the cursor was when you started to type jj, then put it back there once we've erased jj in the remapper.

All 5 comments

this helps

"vim.insertModeKeyBindings": [
        {
            "before": [
                "d",
                "f"
            ],
            "after": [
                "<Esc>",
                "h"
            ]
        }
    ]

Ah good catch!

Just to clarify what I see to reproduce this, remapped keys to esc (I use jj) do not leave the cursor in the same place as just esc when leaving insert mode. It is supposed to be 1 char backward from where it is

This must be because I reverse the keystrokes but don't reverse the cursor position.

I think the correct way to do this would be to record where the cursor was when you started to type jj, then put it back there once we've erased jj in the remapper.

found out that my hack working bad if you are at the end of the line

so is there any workaround for this? I'm trying to start using vscode instead of vim again and stuck with this same bug

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stefanoio picture stefanoio  路  3Comments

liamdawson picture liamdawson  路  3Comments

spinningarrow picture spinningarrow  路  3Comments

st-schneider picture st-schneider  路  3Comments

waltiam picture waltiam  路  3Comments