1

I found similar topic, but I want to do something different. When using nerd command, in normal mode You can do:

5ggv12gg,c<space>

It will toggle comment from line 5 to 12. But instead I would like to be able to write:

:5,12Ct

So I tried to write my own command for that using predefined nerd commenter command:

command! -nargs=? -range=% Ct <line1>ggv<line2>gg<Leader>c<space>

but as I assumed it gives me an error "not an editor command: 5ggv12gg,c " - probably because it expects command like :something, not normal mode command.

Is there a way to achieve something like this?

Community
  • 1
  • 1
Lucas
  • 2,587
  • 1
  • 18
  • 17
  • Side note, I never use `gg` but `G` to go to a specific line (except the first one). I would like a poll to know what habits stackers have regarding that… – Benoit Feb 21 '12 at 13:56
  • @Benoit, I use `:12` to jump to specific line. – mike3996 Feb 21 '12 at 14:06
  • @Lucas http://stackoverflow.com/questions/9175314/how-to-comment-out-in-a-paragraph-of-haml-in-vi/9226398#9226398 This may help you a bit – Bernhard Feb 21 '12 at 15:42

1 Answers1

3

You can use :normal, as in :normal <line1>ggv<line2>gg<Leader>c<space>. See :help normal for details.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224