On 2006-08-17, Uri Moszkowicz <[EMAIL PROTECTED]> wrote:
> I'm in the process of updating from vim 6.3 to vim 7.0 and am having
> trouble getting comments to work to support Doxygen. I add the
> following line to my vimrc file (~/.vimrc):
>
> set comments=s1:/*!,mb:\
> ,ex:*/,f://!,://,b:#,:%,:XCOMM,n:>,fb:-,s1:/*,mb:*,ex:*
>
> When I run vim and ":set comments", though, I see the following:
> comments=sO:* -,mO:* ,exO:*/,s1:/*,mb:*,ex:*/,://
>
> Some change in vim 7.0 results in changing the comments line. In the
> documentation there is a hint about some file-specific comments but
> the standard method of setting file specific options doesn't help
> either:
>
> autocmd BufNewFile *.cc set
> comments=s1:/*!,mb:\,ex:*/,f://!,://,b:#,:%,:XCOMM,n:>,fb:-,s1:/*,mb:*,ex:*
>
> Anyone have any idea how I can get my comment options to work correctly
> again? Or some documentation that I can read about how vim 7 changed
> this feature?
As far as I know, vim 7 did not change that feature. I only went
back as far as vim 6.4, but the behavior I tested was the same in
both 6.4 and 7.
I can think of two reasons you're having this problem. The first is
that you put the autocommand before the "filetype plugin on" in your
.vimrc. Any BufNewFile or BufRead autocommands in your .vimrc need
to be after any "filetype [...] on" commands or else their settings
will be overridden by any setting of the same options in the
filetype plugins.
The second is that when I execute your "set comments" command, I get
the following error:
E525: Zero length string:
comments=s1:/*!,mb:\,ex:*/,f://!,://,b:#,:%,:XCOMM,n:>,fb:-,s1:/*,mb:*,ex:*
When that command is executed in an autocommand, it comes and goes
pretty quickly, so if that's the problem, you may not have seen the
message. After opening a new .cc file, you can execute
:message
to see if that's what happened.
I didn't look closely at your 'comments' setting, but the backslash
immediately followed by the comma looked suspicious, so I inserted a
space there,
set comments=s1:/*!,mb:\
,ex:*/,f://!,://,b:#,:%,:XCOMM,n:>,fb:-,s1:/*,mb:*,ex:*
and the command executed without error.
One more thing: When you're testing this, you can execute
:verbose set comments?
to see where the 'comments' option was last set.
HTH,
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
| Spokane, Washington, USA