Search code examples
visual-studio-codevscodevim

How do I rebind Y to yank to the end of the line when using VS Code's Vim extension?


I'm using VS Code's neovim integration with neovim installed from snap. I want Y to work the same way as D and C. In ~/.config/nvim/init.vim I would add

map Y y$

How do I do this in VS Code? I've tried

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["Y"],
            "after": ["y$"]
        },
    ],

and

    "vim.normalModeKeyBindings": [
        {
            "before": ["Y"],
            "after": ["y$"]
        }
    ],

but neither worked.


Solution

  • Turns out you need to specify and separate each key into an individual "", so that would be:

    "vim.normalModeKeyBindings": [
        {
            "before": ["Y"],
            "after": ["y", "$"]
        }
    ]