pseewald / vim-anyfold

Language agnostic vim plugin for folding and motion based on indentation.
MIT License
268 stars 11 forks source link

folding in C Allman style? #5

Closed juanpabloaj closed 7 years ago

juanpabloaj commented 7 years ago

any_fold is compatible with Allman style ?

https://en.wikipedia.org/wiki/Indent_style#Allman_style

while (x == y)
{
    something();
    somethingelse();
}

with the curly bracket under

pseewald commented 7 years ago

Yes it is compatible but folds are based on indents, not braces (see #4). If you use vim-anyfold with this example, it folds the whole block (including braces) and the fold is displayed with the first while() line. The way it is implemented now is that braces are simply ignored (similarly as empty lines) and thus included in the fold.

A folding mechanism that defines blocks based on braces instead of indents is a planned feature (as mentioned in #4). I'm not sure yet how to detect braces in Vim in an efficient and general (language independent) way...

juanpabloaj commented 7 years ago

thanks. I understand, if you consider this issue very similar to #4 close the issue

pseewald commented 6 years ago

@juanpabloaj Better defaults for braces are now implemented (as of commit 8907928678e2c16ee9adfbe41a6845ab655f628d)