1

Currently I'm new to vim so I installed https://marketplace.visualstudio.com/items?itemName=vscodevim.vim in vscode to get accustomed of vim.

I want to disable insert mode of vim in vscode because as insert mode is enabled in vscode, the many shortcut keys of vscode is disabled. For instance Ctrl+j in vscode open a terminal however this operation is not adopted since vim also has same keybinding. Quite annoying.

I viewed content of ~/.vscode/extensions/vscodevim.vim-1.20.2/package.json however seemingly there is no way to only disable insertmode in vscode.

Or is there some way which takes priority of effect of shortcut key of keybinding of vscode than vim one?

What should I do for next?Or can it even able to do that?

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Try [this](https://stackoverflow.com/a/47914944/13020139). If I'm not mistaken, will allow you to toggle back to vscode mode for vscode shortcuts. Not the best solution, but maybe a step in the right direction. – wxz May 07 '21 at 02:16
  • Check out the `vim.handleKeys` property in [VSCodeVim Settings](https://github.com/VSCodeVim/Vim#vscodevim-settings). This allows you to delegate configured keys to be handled by VS Code instead of Vim – AnsonH May 07 '21 at 02:54
  • Both ways worked.Thx for the advices. –  May 07 '21 at 03:09
  • 1
    How can you hope to ever "get accustomed to Vim" if you don't use Vim? – romainl May 07 '21 at 05:46

2 Answers2

0

Not a complete solution however this is the one of the provisional solutions.

Add the following inside ~/.config/Code/User/settings.json

 "vim.handleKeys": {
    "<C-j>": false,//keybinding of vim which you want to disable
  }
0

I started configuring my VSCode vim setup using the shortcuts GUI. If you simply search for a key combination, eg. "ctrl+j" (with quotation marks) in the search bar in the shortcuts tab, you can find exactly what is capturing what input. This is what that looks like for me. The way to disable vim shortcuts is then to simply remove the preconfigured vim shortcut keybinding from the vim extension (you can always reset it back). This is what looking up vim binds can look like. The other solution is probably the "better" solution, but this method can be useful for way more than just vim binds, so its what I use.

Mikkel
  • 1
  • 1