I am slightly new to vim, and I installed the vim vscode plugin so I can use vim-like melodies to manipulate code in vscode. However, I used to have janus installed on my terminal (including NERDTree, NERDCommenter, etc) and I want to install NERDCommenter on my vim vscode. How would I go about doing this?
-
If you want to use Vim plugins, you need to use Vim, not VS Code. On the other hand, VS Code might already include features that are brought to Vim by plugins, for example a file browser. – mkrieger1 Jun 09 '20 at 22:24
-
vscode already includes a tree/dir browser by default. You can use the hjkl keys to browse it. In the code window you can create panes and use Ctrl W hjkl to navigate between panes as well as the tree explorer. For commenting just use Ctrl / . You can select blocks of code using v + a + t (code between specific tags) or v + 10 j (for the next 10 lines) and do Ctrl / . Feel free to check any other use cases. I am new to vscode and somewhat experienced with vim, so still learning my way around. – ahron May 09 '21 at 16:04
3 Answers
This is not possible, you cannot use VIM plugins on the VSCode Vim. I am not familiar with NerdCommenter but you can just remap VSCode keys.

- 31
- 4
Seems like NERD* Plugins is written for vim.
As for VSCode, here is a workaround:
- You can download VS Extentions replacement for your plugins.
- Check out the VSCode Extentions Marketplace to look for your replacement.
There are so many good extentions.It's very likely to find one replacement for you there.
As for comment code:
- I perfer use ⌘ + / to comment my selection area.
- You can change the Keyboard Shortcuts for
Toggle Line Comment
.

- 354
- 2
- 10
-
2`CTRL` + `/` in VS code isn't as powerful as NERD though :-( It seems to apply only line-level comments, and doesn't recognise how to comment (or uncomment) block-comments `/* ... */` – cartbeforehorse Aug 13 '21 at 12:45
-
1@cartbeforehorse I usually just select all the lines I want and then use `CTRL+/`. To create a block comment there is also : https://stackoverflow.com/q/34316156/19955621 – userrandrand May 22 '23 at 06:22
If the plugin you're after is written in vimscript (typically, it'll have the .vim
extension) then you can load its contents into your .vimrc
configuration file. As of writing this, the Vim extension for VS Code supports .vimrc
configuration files.
This isn't a great solution as you'll have to manually update any plugins you add and it'll add bloat to your .vimrc
file. But it does work. I'm using this workaround to load in vim-commentary by tpope and so far it's working well.

- 1,861
- 1
- 19
- 29
-
The documentation at https://marketplace.visualstudio.com/items?itemName=vscodevim.vim says that vimrc support is experimental and only supports remaps – userrandrand May 22 '23 at 06:25