I work with quite a bit of multi-platform C/C++ code, separated by common #defines (#if WIN, #if UNIX, etc). It would be nice if I could have vim automatically fold the sections I'm currently not interested in when I open a file. I've searched through the vim script archives, but I haven't found anything useful. Any suggestions? Places to start?
Foldimate says that you can fold an entire load of laundry in about five minutes, which includes collared shirts, pants, and medium-sized towels.
FoldiMate was a California-based company developing a robotic laundry-folding machine founded in 2012. Their clothes folding machine was aimed to enter the market by the end of 2019. In 2021, the company folded.
Just add a folding region to your syntax http://vim.wikia.com/wiki/Syntax_folding_of_Vim_scripts#Syntax_definitions
:syn region myFold start="\#IF" end="\#ENDIF" transparent fold
:syn sync fromstart
:set foldmethod=syntax
To add to @hometoasts answer, you can add that command as a comment in the first ten or last ten lines of the file and vim will automatically use it for that file.
/* vim: syn region regionName start="regex" end="regex": */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With