At first, I use the set foldmethod=marker, and move the cursor to the { of one function, use the zf% to fold current function. But there are a lot of functions in this file. How can I fold all functions in this file? And I don't want to fold {} in the functions.
If you :set foldmethod=syntax
the folds will be specified from the syntax definitions. If you prefer you can :set foldmethod=indent
to have the indentation define the folds.
You can close all folds with zM
. If you have nested folds and you want to fold level by level, use zm
. To open folds use zR
(all) and zr
(level by level).