121301Re: Proper handling of C style // comments?
- Mar 2, 2011Hi kuru!
On Mi, 02 Mär 2011, kuru wrote:
> Currently when ever I open .c files, "//" comment lines show up as
> "errors" based on the color syntax. I have tried the latest c.vim from
> last November which seems to resolve the issue but that one is
> relatively shorter and not as extended as the previous c.vim syntax
> file. So I am trying to find the offending lines in the older c.vim
> and resolve the mishandling. The only thing is that I am not so
> profound with the expressions in the syntax files. And I just cannt
> figure out how to fix it. I am hoping that someone might be able to
> help me out here
Where did you get this syntax file from? It doesn't happen here with the
latest Vim runtime file and also not with Vim 7.2.
So you might need to investigate the syntax file. On the
//-comment line, enter the following line:
:echomsg synIDattr(synID(line("."), col("."), 1), "name")
It should output something like cComment
Now open the syntax file and search for that item. There should be a
line like this:
hi def link cComment <item>
Now in your .vimrc put this:
" Fix annoying // Comments in C files:
hi link cComment Comment
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
- << Previous post in topic Next post in topic >>