3

I'm reading Learn Vimscript the Hard Way - Chapter 18, which is also about folds.

I'm surprised to see that copying the sample code

" Vimscript file settings ---------------------- {{{
augroup filetype_vim
    autocmd!
    autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}

into my ~/.vimrc, saving it, closing it, reopening it, putting the cursor on one of those lines, and pressing za doesn't have any effect.

Putting it more simply, if I don't do do anything of what I've written above, but I just paste the following in my ~/.vimrc

" Folding ---------------------- {{{
" this should be foldable
" }}}

then run :set foldmethod=marker and then I hit za on the middle line, nothing happens.

What can I be doing wrong?

1
  • Do you have foldenable on? (toggle with zi)
    – D. Ben Knoble
    Commented Oct 19, 2020 at 15:19

1 Answer 1

2

Commenting the ~/.vimrc and uncommenting it bit by bit I found out that the reason for the folding not working was that I was setting foldminlines to a value higher than the number of lines of the fold I was trying to close.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.