Search code examples
visual-studio-codevscodevim

VSCode Vim plugin folding ctrl+k ctrl+<number>


I'm using VSCode with Vim extension enabled.

By default, VSCode Ctrl+K Ctrl+number would fold the code of the entire file to the indent level set by the number.

VSCode default folding commands

This is EXTREMELY useful for me, and I use it all the time.

The problem is: with the Vim extension enabled, those commands doesn't work anymore.

This extension also doesn't allow (as far as I know) to change configurations such as ":set foldmethod=indent".

Are there any workarounds?

Thank you very much!


Solution

  • ORIGINAL SOLUTION:

    The most simple solution I found was to disable Vim: Use Ctrl Keys at

    Settings > Extensions > Vim > Vim: Use Ctrl Keys
    

    (you can type "vim ctrl" in the search bar to find it faster).

    VSCode Settings > Vim: Use Ctrl Keys

    You can also add "vim.useCtrlKeys": false, directly in your settings.json.

    It's good enough for me, but be aware that it can mess up your Vim commands, as it will not use any Ctrl commands anymore.


    MUCH BETTER SOLUTION:

    Just put this in settings.json!

    "vim.handleKeys": {
        "<C-k>": false
    },