Support different fold methods in different buffers
lervag opened this issue · 4 comments
Hi. If I open a tex file that uses fdm=expr
, then open a bib file that uses fdm=syntax
(set from a personal ftplugin file), then the fdm=syntax
will override the expr
setting for tex files in FastFold. That is: FastFold no longer remembers that the tex file should generate folds with fdm=expr
.
I think the reason that this does not work is because FastFold uses window variables (e.g. w:lastfdm
) to store the last fdm
setting. I think it should rather use a buffer variable b:lastfdm
.
I see this is partially discussed in #15. I still think my use case should be supported, which is to keep a single window, but to change the buffer. In this case, the b:lastfdm
should be updated and used.
Pushed a commit that makes fdm
as buffer local as possible. As I use vim-stay
, I didn't notice this issue because it was covered by https://github.com/kopischke/vim-stay/blob/master/plugin/stay.vim#L62. Surprised nobody complained before.
Forgot: Thanks for bringing this up!
Agreed that it is surprising that no one noticed this before. Although it was a little bit tricky to pinpoint what was going on. Anyways, thanks for fixing!