Closed mikeboiko closed 1 month ago
I have the same problem, since updating to MacVim 8.2
8.2 (2019 Dec 12, compiled Aug 19 2020 06:53:53)
macOS version
Included patches: 1-1456
Compiled by Homebrew
In 8.2 there seem to be some changes that affect folding.vim
Although I am a developer, I am not a vim developer, but this is what I could figure out to get a workaround that seems to function in 8.2.
The following line no longer sets foldtext
let &l:foldtext = s:SID() . 'FoldText()'
I think this is why we don't see the headings for the folds.
As a workaround, to set foldtext I first cloned FoldText() to the following since I need access to it at a wider scope than the original definition:-
" Workaround for vim 8.2
function FoldTextWorkaround()
let level = HeadingDepth(v:foldstart)
let indent = repeat('#', level)
let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
let foldsize = (v:foldend - v:foldstart)
let linecount = '['.foldsize.' line'.(foldsize>1?'s':'').']'
return indent.' '.title.' '.linecount
endfunction
And then changed
if g:markdown_fold_override_foldtext
let &l:foldtext = s:SID() . 'FoldText()'
endif
to
if g:markdown_fold_override_foldtext
"let &l:foldtext = s:SID() . 'FoldText()'
setlocal foldtext=FoldTextWorkaround()
endif
With this workaround fold headings in 8.2 look very similar again to how they look in 8.0 and earlier. I'm prepared to use it for now, but the issue does need looking at by someone with vim experience.
Thanks for the snippet @arcdale! Since @masukomi doesn't seem to be maintaining this plugin anymore, I made a fork and implemented your bug fix. For other users experiencing this issue, you can clone my fork: https://github.com/mikeboiko/vim-markdown-folding
Following the discovery of @arcdale, I did some research and find that this fix will do the job. :h sid
says it.
I forked the repo. However writing up a backward compatible fix with proper test is too much for a first time vim script writer. I put it out here for review. And probably come back to finish the rest (comparability and test)
@mikeboiko THANK YOU.
as a note: still looking for a new maintainer for this project. If any of you lovely people are interested in taking it over, please let me know. ;)
Following the discovery of @arcdale, I did some research and find that this fix will do the job.
:h sid
says it.I forked the repo. However writing up a backward compatible fix with proper test is too much for a first time vim script writer. I put it out here for review. And probably come back to finish the rest (comparability and test)
Can confirm
as a note: still looking for a new maintainer for this project. If any of you lovely people are interested in taking it over, please let me know. ;)
~~Since I'm doing the opposite migration to you (from doom emacs back to nvim) I might be able to maintain the plugin at least at a superficial level (reviewing PRs, addressing issues, polishing docs). It's unlikely that I'll ever go deep into vimscript, but if I'm not back on emacs in a week or two I'll shoot you an email. Using this plugin to emulate org-modes outlining behaviour while writing a paper with markdown + pandoc~~
nvm
fixed with PR #43 (Fixed issue with s:SID in Vim 8.2 )
I created a simple markdown file to show the differences between vim versions.
test.md
:Old vim - version
Old vim - folded buffer shows heading text properly
New vim - version
New vim - folded buffer doesn't show heading text
Hopefully this is an easy fix. Thanks!