On 01/09/2011 05:25 PM, Daniel Dilts wrote:
>
> Folds rock. There is a command that you can put in your vimrc that
> will autofold on syntax, so it will fold on all {} blocks as you code.
I've been messing with folds recently and thought syntax folding looked
like a great idea. But I found it only worked if you used the standard
C function block syntax, for example:
void MyFunction()
{
...
}
is folded into a pretty:
void MyFunction()
<fold information line { ... >
The function declaration still has it's normal syntax highlighting, and
the fold information line is reverse highlighted, no syntax highlighting
inside it. But my style is a cross of styles that works great for me
except in vim with syntax folding:
void MyFunction() {
...
}
is folded into a not so pretty:
<fold information line void MyFunction() { ... >
Which only has the reverse highlighting of the fold, and the declaration
is no longer in the first column (left-justified). It would be a little
better if the declaration part of the fold status line has normal syntax
highlighting to make the function stand out; so it didn't look like an
arbitrary fold. Ideally, I've been looking for some syntax description
modification/file, script, or setting change that would make syntax
folding work like so:
void MyFunction() {
<fold information line ... >
So, the function declaration still left-justified, highlighted, and the
rest of the function definition is folded. So far I haven't found
anything that worked besides manually folding the range. I finally gave
up and used the standard C syntax just to get through the project, but I
have the same problem in existing C/C++, Perl, and Java code that does
use my preferred style.
Long question short, does anyone know a good way to make Vim fold the
way I want it to?
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list