How to move cursor using vim in vscode without forgetting previous column?

Viewed 98

Recently I install vscodevim extension on vscode. Everthing works fine except moving the cursor across line bothers me.

Here is current status: (where ---^--- denotes the cursor)

#include <iostream>

int main() {
    std::cout << "Hello world\n";
//------------------^-------------------

    std::cout << "hello world\n";
}

after press jj in normal mode:

#include <iostream>

int main() {
    std::cout << "Hello world\n";

    std::cout << "hello world\n";
^--------------------------------
}

What I want:

#include <iostream>

int main() {
    std::cout << "Hello world\n";
//------------------^-------------------

    std::cout << "hello world\n";
}

after press jj:

#include <iostream>

int main() {
    std::cout << "Hello world\n";

    std::cout << "hello world\n";
//------------------^-------------------
}

How can I achieve this?

Here is my vim settings

    // vim settings
    "vim.easymotion": true,
    "vim.useSystemClipboard": true,
    "vim.normalModeKeyBindings": [
            {
                "before": ["u"], 
                "after": [],
                "commands": [
                    {
                        "command": "undo", 
                        "args": [], 
                    }
                ] 
            },
            {
                "before": ["<C-r>"], 
                "after": [],
                "commands": [
                    {
                        "command": "redo", 
                        "args": []
                    }
                ] 
            },  
            {
                "before": ["j"], 
                "after": ["g","j"], 
            },
            {
                "before": ["k"], 
                "after": ["g","k"], 
            },
    ],
    "vim.statusBarColors.commandlineinprogress": "",
    "vim.leader": "<space>",
    // "vim.useCtrlKeys": true,
    "vim.handleKeys": {

        "<C-a>": false,
        "<C-f>": true,
        "<C-r>": true,
        "<C-y>": false,
        "<C-d>": true, 
    },
    "vim.overrideCopy": true,
    "vim.smartRelativeLine": true,
    "editor.lineNumbers":"relative", 
0 Answers
Related