Whatever I do, I don't seem to get syntax folding running for shell scripts.
So I have a file called abc.sh
call
:let g:sh_fold_enabled=7
:let g:is_bash=1
:set foldmethod=syntax
But it still can't find any folds. Why is that?
Whatever I do, I don't seem to get syntax folding running for shell scripts.
So I have a file called abc.sh
call
:let g:sh_fold_enabled=7
:let g:is_bash=1
:set foldmethod=syntax
But it still can't find any folds. Why is that?
This problem is solved in a discussion on Reddit.
The trick is to put those commands into your vimrc at the top.
set nocompatible
filetype plugin indent on
set foldenable
set foldmethod=marker
au FileType sh let g:sh_fold_enabled=5
au FileType sh let g:is_bash=1
au FileType sh set foldmethod=syntax
syntax enable
IMO fold-level 5 works better than 7, so that's what I put into the code above.
I put the above just after my plugins section.
This question is also discussed, with a slightly different solution, in the following post: Here.