Vim: Ctrl+D / Ctrl+U (page down/up) moves selection when in Visual Line mode

Created on 12 Oct 2016  路  9Comments  路  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.


What did you do?

Make sure vim.useCtrlKeys setting is set to true.
Open a file that has more content than can fit on the screen.
Place cursor on the first line.
Press Shift+V to enter visual line mode (bug is present in visual mode as well)
Press Ctrl+D for a page down movement
Notice that the selection is now gone or starts in a different place

What did you expect to happen?

Text selection should still start on the line which user started Visual mode in.

What happened instead?

Text selection moves to the current cursor location.

Technical details:

  • VSCode Version: 1.6.0
  • VsCodeVim Version: 0.3.7
  • OS: macOS Sierra
kinenhancement upstreavscode

Most helpful comment

One clever workaround until the VSCode team fixes our bug is to redefine C-u and C-d in terms of k and j using remappings:

    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["<C-u>"],
            "after": ["2", "0", "k"]
        },
        {
            "before": ["<C-d>"],
            "after": ["2", "0", "j"]
        }
    ]

Now the selection will work properly again.

All 9 comments

Me too!! I need a solution to continue use cmd+D normally please

An issue has been opened on VSCode to track this: https://github.com/Microsoft/vscode/issues/16248

One clever workaround until the VSCode team fixes our bug is to redefine C-u and C-d in terms of k and j using remappings:

    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["<C-u>"],
            "after": ["2", "0", "k"]
        },
        {
            "before": ["<C-d>"],
            "after": ["2", "0", "j"]
        }
    ]

Now the selection will work properly again.

@johnfn, thanks for the workaround! Just wanted to comment that "20", "k" would not work for me. I assume this is because 20 isn't a single key press.

Changing it to "after": ["2", "0", "k"] works for me.

@kylpo you are exactly right. Thanks for the correction! I've updated my post.

This was supposedly fixed in #1859, but I still have this issue in the latest version of Code.

I had to use this to get what I was looking for (keeping the cursor on the same screen line as I page up and down):

    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["<C-u>"],
            "after": ["2", "0", "<C-y>", "2", "0", "k"]
        },
        {
            "before": ["<C-d>"],
            "after": ["2", "0", "<C-e>", "2", "0", "j"]
        }
    ]

@jkfranci I'm new to VSCode, where do you paste that code?

Hi all,
If any of you is still experiencing this. What fixed mine was to have VScode let the vim extension to handle the ctrl+u and ctrl+d keys by setting.

"vim.handleKeys": {
    "<C-d>": true,
    "<C-u>": true,
},
Was this page helpful?
0 / 5 - 0 ratings

Related issues

spinningarrow picture spinningarrow  路  3Comments

orn688 picture orn688  路  3Comments

triztian picture triztian  路  3Comments

waltiam picture waltiam  路  3Comments

AndersenJ picture AndersenJ  路  3Comments