There are a bunch of different methods for folding (indentation, manual markers, custom syntax-based folding, etc), and which one you want usually depends on the file type.
I have a bunch of autocommands for different files that set the foldmethod appropriately. For example:
augroup ft_vim
au!
au FileType vim setlocal foldmethod=marker foldmarker={{{,}}}
augroup END
augroup ft_js
au!
au FileType javascript setlocal foldmethod=marker foldmarker={,}
augroup END
This makes Vim fold using markers for Vim and Javascript files. The Vim markers are the usual {{{ and }}}, but Javascript has it's own "built-in" markers we can take advantage of, so it uses { and }.
There are a bunch of different methods for folding (indentation, manual markers, custom syntax-based folding, etc), and which one you want usually depends on the file type.
I have a bunch of autocommands for different files that set the foldmethod appropriately. For example:
This makes Vim fold using markers for Vim and Javascript files. The Vim markers are the usual {{{ and }}}, but Javascript has it's own "built-in" markers we can take advantage of, so it uses { and }.