1

in my init.rc I have the following:


autocmd BuffWrite *.* mkview
autocmd BuffRead *.* silent! loadview

In my init.lua I have:

vim.opt.foldmethod = 'marker'

In my working files I use the following blocks to create folds:

// Header {{{1


***This is the foldable area***


// }}}

The problem I have is that everytime I add code to a foldable area and save it, the foldable area folds automatically. This is particularly annoying when I have multiple levels of folds. Because they all fold automatically on save.

How do I prevent this behavior?

1 Answer 1

1

I have experienced the same behavior with RestructuredText (rst) files with the RIV vim plugin.

RIV adds an au! BufWritePost <buffer> call riv#fold#update() that collapse all folds when a file is saved/written. To disable this feature, add the following to your .vimrc.

let g:riv_fold_auto_update=0
1
  • thank you. This worked!
    – Ram Fattah
    Commented May 13 at 6:08

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.