开发者

Defining my own command

开发者 https://www.devze.com 2023-03-09 14:40 出处:网络
I\'m trying to define my own command in MacVim to turn a c statement or range of statements into comments.So I put this in my vimrc:开发者_StackOverflow

I'm trying to define my own command in MacVim to turn a c statement or range of statements into comments. So I put this in my vimrc:开发者_StackOverflow

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

It works fine if I just enter :Com to comment the current line. But if I enter something like :Com 3 5 in order to turn lines 3 thru 5 into comments I always get this error message:

E488: Trailing characters

Can anyone help?


You need to provide the range before the command, like that:

:3,5Com

Anyway, I suggest you to check the NERD_commenter plugin. It's great for commenting source code.

0

精彩评论

暂无评论...
验证码 换一张
取 消