Search code examples
visual-studiovsvim

VSVim - Escape mapping breaks cursor position behavior


I reduced my _vsvimrc file to a single line :

inoremap jk <esc>

Now whenever I hit jk or esc directly, it gets back to normal mode but also puts the cursor at the column 0 : gif showing the behavior.

Removing the mapping of jk resolves the issue.

Is this expected behavior ? I did the same test in Gvim and it does not seem to have the same issue.

Related issue on github


Solution

  • This behavior is operating by design here. In this example the caret is in virtual space when you hit <Esc> (either directly or via jk). When that occurs VsVim will put the caret in the last real space on the same line.

    It's easier to see this behavior if you enable white space viewing in Visual Studio:

    • Edit -> Advanced
    • Check View White Space