VSCodeVim: Moving cursor in a wrapped line

I installed VSCodeVim into my Visual Studio code to code only with keyboard.

But like above, a long line is wrapped so actually it’s a single line but it’s shown as multiple lines. In this case, if I pressed k or on the first (visible) line, the cursor moves to the next actual line which I don’t want to at all!

How to solve

Actually it’s not a problem but a characteristic of Vim with wrapped line, so I found a document as a workaround. Then I could adopt it into Visual Studio code as well.

Firstly, open Settings page and move to Vim: Normal Mode Key Bindings section. Then you can see Edit in settings.json button. In the following JSON file, put below blocks will solve the issue.

        "vim.normalModeKeyBindings": [
          {
            "before": ["<Up>"],
            "after": ["g", "k"]
          },
          {
            "before": ["<Down>"],
            "after": ["g", "j"]
          }
        ]

Built with Hugo / Theme Stack designed by Jimmy