Sunday, September 2, 2012

set comments for C-style comment

Hi all,

I am using a language whose comment is same as C's. So I copied some lines from c.vim so that my vim could automatically insert a comment after a newline in the middle of the comment.

More precisely, I added the two following lines:

setlocal fo-=t fo+=cronql
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://

It works but with some flaws:

When I type /* <CR>, I got this:
/*
*

It can correctly automatically generate the *, but no space in front.

However, what I want is this (notice the space in the second line):
/*
*

It should generate <space>* after I type Enter (or "o" in command mode).

I think it should be very easy by setting comments option. But I still cannot figure it out. It would be nice if anyone could help me on this.

Regards,
-Monnand

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment