swekaj / php-foldexpr.vim

Vim folding for PHP with foldexpr
MIT License
41 stars 10 forks source link

fold docblocks above classes like those above functions #23

Closed modelm closed 9 years ago

modelm commented 9 years ago

Disclaimer: This is the first time I've written any vim script and I am not sure the regex is 100% correct.

All I tried to do is fold docblocks above classes like those above functions. There may be more that should be in the regex to make it work in all cases, but it works for everything I've tried so far.

Also: thank you for writing this and for making it publicly available! I was previously using phpfolding.vim and I really like the folding style of this plugin, and it seems to handle different coding styles better.

modelm commented 9 years ago

Actually, there are a few problems I just noticed - doesn't work when the line begins with "class" as opposed to "abstract" (for instance), and the class name is not in the fold text like it is with functions. I will try to see if I can make that work but in the meantime I guess consider this a feature request.

modelm commented 9 years ago

I got far enough to make folding work better (https://github.com/swekaj/php-foldexpr.vim/commit/b7ebdfb036e3fc7b7947c11f05117885350b4e60), but still not sure how to get the class name in the fold text. It seems like you may want to make a separate function independent of ExtractFuncName but I guess at this point I'll leave it up to you to add that and merge this if you want.