Sunday, May 22, 2011

Re: Hide comments without remove?

Hi Antonio!

On Sa, 21 Mai 2011, Antonio Recio wrote:

> Well I obtain all folded because there are
> {
> ...
> }
>
> But the question is how I can fold only the // comments including the empty
> lines and the /*...*/, but not the {}.

Seems, there is no easy way available. So I'd suggest, copying
$VIMRUNTIME/syntax/c.vim to ~/.vim/syntax and changing that line:

,----
| syntax region cBlock start="{" end="}" transparent fold
`----

and remove the fold attribute. There is another line similar to this
above, which you can also change, if you'd like to use the c_curly_error
setting.

For tweaking the syntax highlighting of you C/C++ files (and to find
out, what c_curly_error does), I suggest to read :h ft-c-syntax (the
C-syntax is also used for C++ syntax highlighting).

Save, and start editing a new cpp file, and the {} blocks shouldn't be
folded anymore, when using :set fdm=syntax

see also
:h mysyntaxfile
:h mysyntaxfile-replace

regards,
Christian

--
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