11

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?

2
  • 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. Commented Jun 9, 2020 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. Commented May 9, 2021 at 16:04

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Seems like NERD* Plugins is written for vim.

As for VSCode, here is a workaround:

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.

2 Comments

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 I usually just select all the lines I want and then use CTRL+/. To create a block comment there is also : stackoverflow.com/q/34316156/19955621
2

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 Comment

The documentation at marketplace.visualstudio.com/items?itemName=vscodevim.vim says that vimrc support is experimental and only supports remaps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.