farmergreg / vim-lastplace

A vim / nvim plugin that intelligently reopens files at your last edit position.
https://www.gregd.org/
MIT License
583 stars 28 forks source link

let g:lastplace_open_folds = 0 still opens fold after reopening file #22

Closed astier closed 4 years ago

astier commented 4 years ago

Hi. Folds open after reopening a file even tho let g:lastplace_open_folds = 0 is set.

  1. Set let g:lastplace_open_folds = 0 in your vimrc
  2. Open file & create a paragraph
  3. Fold paragraph with zfip
  4. Exit vim and open it again
  5. See that fold is now open

I use nvim v0.4.3

farmergreg commented 4 years ago

Hi, Thanks for the bug report!

I don't use folds a lot. Can you help me understand more about your setup? What foldmethod are you using? Anything else unique about your setup? Can you provide a sample document that I can fold some paragraphs with zfip? Also, how does vim behave if you temporarily remove vim-lastplace?

Thanks!

astier commented 4 years ago

Minimal vimrc:

cal plug#begin('~/.local/share/nvim/plugins')
Plug 'farmergreg/vim-lastplace'
cal plug#end()
let g:lastplace_open_folds = 0

" this
" is
" a
" paragraph
" fold
" me

Foldmethod should then be manual. Without lastplace vim also opens the fold after reopening the file. But this is expected behavior.

Or do I misunderstand the purpose of lastplace_open_folds?

farmergreg commented 4 years ago

It's behaving as expected. The g:lastplace_open_folds feature won't close any folds. It will only open them, when needed.

vim-lastplace doesn't have any mechanism to save the view state which would include folds. If you'd like vim to remember what was folded, you might need to use mkview / loadview, or find a plugin that would manage that for you.

Thanks for your bug report! I'll close it for now. Please feel free to re-open it if you have any further questions or thoughts.

astier commented 4 years ago

Oh yeah sorry somehow. I missunderstood the docs. I was sleep deprived.

farmergreg commented 4 years ago

@astier happens to the best of us :)