In .vimrc add autocmd for BufWinEnter to automatically open all folds as follows:
autocmd BufWinEnter * silent! :%foldopen!
Tell vim to execute silent :%foldopen! after opening the BunWinEnter event (see :h BufWinEnter ). silent %foldopen! will execute foldopen in the entire buffer thanks to % and will recursively open all summaries because of ! , Any possible error message will be suppressed silent . (You may receive error messages such as E490: No fold found if the buffer is not actually already compiled)
Note. You can use BufRead instead of BufWinEnter , but then if the file has a model that allows folding that will override this autocmd. I mean BufRead autocmds, which run before the model is processed and BufWinEnter will run them after. I believe a later version will be more useful
ecerulm May 15 '14 at 7:58 a.m. 2014-05-15 07:58
source share