oscarh/vimerl — comment on commit 40166edd8f29c09f8177b88fbedc0c91e243bbab
File:  line 0
By jimenezrick:

In my case, Erlang, C/C++, Python and OCaml start by default with code folded. So, I don't like it because of that I use `set nofoldenable`. But I have to note that I modify `foldmethod`, so that could explain why you don't see you code automatically folded.

By default, Vim starts with `foldenable` and `foldmethod=manual`, so that's way most of the times, folding is enabled but your code is not rellay folded, because Vim waits to be done by you. If you modify `foldmethod` (like Vimerl does), the folding will take place automatically. So that's is why is necessary to use `set nofoldenable`. And that's the standard way to do it.

If you need to set different settings for different programming language, then `:help autocmd` is what you need.

Look in my Vim config and see some example of these:

https://github.com/jimenezrick/vimconfig/blob/master/vimrc#L43
https://github.com/jimenezrick/vimconfig/blob/master/vimrc#L52

But going directly to the point, you need:

autocmd FileType erlang setlocal nofoldenable

That's all, and that's the Vim way to make this customization for you language of choice.