I am in the process of customizing my vim setup, and since I write a lot in C, I have a whole function dedicated just for those files, which I call with autocmd filetype c,cpp,h,hpp call C_syntax()
.
The issue I'm having is that I want auto folding to occur on .c and .cpp files, but not .h and .hpp files. In order to do this, I have tried:
function C_syntax()
autocmd filetype c,cpp setlocal foldmethod=syntax
"---snip---
endfunction
which disables folding for all files (.c and .cpp included), as well as this:
autocmd filetype c,cpp,h,hpp call C_syntax()
autocmd filetype c,cpp setlocal foldmethod=syntax
which enables it for .h and .hpp files as well.
How would I go about enabling the folding for only .c and .cpp files?
Thanks for any help