0

I've been having a ridiculously hard time getting C/C++ code folding to work with set foldmethod=syntax. To debug my issue I've stripped down my vimrc to only this:

set foldmethod=syntax
syntax on                " also tried putting this first

Now when I open a cpp file, nothing is folded.

Then, doing :syntax off followed by :syntax on will fold the cpp file.

Any idea why that does something not already done by the trivial vimrc?

1 Answer 1

1

After some detective work I tracked down the cause of my issue being that I had a .vim file in my plugin directory that redefined OperatorChars, which broke the syntax based folding for C and C++.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.