0Day Forums
How to fold C code with vim? - Printable Version

+- 0Day Forums (https://0day.red)
+-- Forum: Coding (https://0day.red/Forum-Coding)
+--- Forum: C & C++ (https://0day.red/Forum-C-C)
+--- Thread: How to fold C code with vim? (/Thread-How-to-fold-C-code-with-vim)



How to fold C code with vim? - dorisitpwzivtmd - 07-27-2023

I've been trying to explore code folding options in Vim, and I have stumbled upon this stack-overflow [question][1]. While I have been able to put that into my `vimrc`, the problem I'm having is that **it doesn't fold the multi-line comments above a function**. How do I solve this?


[1]:

[To see links please register here]




RE: How to fold C code with vim? - nematospora524237 - 07-27-2023

The default `syntax/c.vim` provides folding definitions. Unless you define a `c_no_comment_fold` variable, this also folds multi-line comments.

To activate this, just put

:setlocal foldmethod=syntax

into `~/.vim/after/ftplugin/c.vim`.