As discussed in the comments,
autocmd ExitPre ?* tabdo windo mkview
should do it. The event VimLeavePre may be better.
I confess I’m not sure why the pattern is ?* on this one.
Also, don’t forget to augroup.
It possible now using 'fillchars' (from the help):
item default Used for
foldopen:c '-' mark the beginning of a fold
foldclose:c '+' show a closed fold
foldsep:c '|' open fold middle character
For example, set fillchars+=foldopen:▾,foldsep:│,foldclose:▸
With the settings you have it should work.
Press zM to close all folds. Note if you press za on def main it would not toggle the fold -- it doesn't exist on that line. Put your cursor on indented line and press za there
Make sure you have matching shiftwidth to your actual indent.
EDIT You also need to add the following line to your vimrc:
filetype plugin indent on
See :h :filetype-plugin-on and :h :filetype-indent-on this command enable the filetype detection and the loading of the indent scripts which are necessary to have working folding.
You can't set foldmethod directly from the vimrc, see :h 'fdm':
'foldmethod' 'fdm' string (...