Defining my own team

I am trying to define my own command in MacVim to include a c statement or a range of statements in comments. So I put this in my vimrc:

command -range Com :<line1>,<line2>s?^.*$?/*&*/?

It works fine if I just type: Com to comment out the current line. But if I type something like: Com 3 5 to turn lines 3 through 5 into comments, I always get this error message:

E488: Trailing characters

Can anyone help?

+3
source share
1 answer

You need to provide a range before the command, for example:

:3,5Com

In any case, I suggest you check the NERD_commenter plugin . This is great for source code comments.

+6
source

All Articles