4

I'm trying to recreate some of https://github.com/tpope/vim-commentary function's in IdeaVim.

I've tried various mappings in my .ideavimrc, like for example:

nnoremap gcc :action CommentByLineComment<CR>

Which works fine but I cannot do 2gcc to comment out two lines. or ngcc to comment out n lines.

I've also tried to map them like this:

nnoremap 2gcc Vj:action CommentByLineComment<CR><Esc>
nnoremap 3gcc V2j:action CommentByLineComment<CR><Esc>
" etc...

And like this:

nnoremap gc2j V2j:action CommentByLineComment<CR><Esc>
nnoremap gc3c V3j:action CommentByLineComment<CR><Esc>
" etc...

But they don't work.

Any help on how this could be accomplished?

2 Answers 2

13

Ideavim update 0.52, 2019-07-23 brought support for emulation of the vim-commentary plugin.
It can be enabled by putting this line to .ideavimrc:

set commentary
3

It seems IdeaVim contains a number of bugs that prevent the correct execution of this kind of mapping. Feel free to create an issue here.

The functionality of commentary extension is on review right now. You can track it's status here. You can join Early Access Program to receive updates as fast as it possible.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.