Autounfolding when editing code blocks
Hello!
I have a strange problem. When I edit a text in a code block, other folds are unfolded automatically. With standard texts everything ok.
let g:vim_markdown_folding_style_pythonic = 1 Doesn't help me.
Can confirm that I am experiencing the exact same issue and it's driving me crazy.
The difference between your issue and mine is that everything starts folding/unfolding randomly until I wait for it to calm down and later fold the previously opened header for me to continue with my workflow.
I'm having the same issue. If I move my cursor within a code block, everything folds about 1 second after I stop moving my cursor.
same, i can't tell if its trying to refold when the typing stops intentionally.
i can see a reason why that might be desirable but its not consistent, which makes me think theres a bug somewhere.
Also cursor position is often reset to the top of the screen. The "refold everything and jump to top of screen" happens often when i delete a line. The effect is that I delete a line, the buffer is folded to 0, and my cursor is at line 1 or 2, then i keep 'dd'ing and blow away imports.
Because i see it happen most when the line im editing basically goes away even for a fraction of millisecond like between 'dd' and the line below being moved up, the folder is rerunning?
//edited from original below
i think this is the main issue by design
augroup Mkd
" These autocmds need to be kept in sync with the autocmds calling
" s:MarkdownRefreshSyntax in ftplugin/markdown.vim.
autocmd BufWinEnter,BufWritePost <buffer> call s:MarkdownSetupFolding()
autocmd InsertEnter,InsertLeave <buffer> call s:MarkdownSetupFolding()
autocmd CursorHold,CursorHoldI <buffer> call s:MarkdownSetupFolding()
augroup END
from https://github.com/plasticboy/vim-markdown/blob/8e5d86f7b85234d3d1b4207dceebc43a768ed5d4/after/ftplugin/markdown.vim#L195
theres just a lot of listeners that will call fold it may be that my terminal is slow enough that these essentially are tripping over each other to refold the document. I dont know what the right way to prevent more than one of these from firing within a certain time frame.
if anyone has time to test out removing some of these or possibly doing a debounce in MarkdownSetupFolding it would be appreciated. ill see if i do later this week
If anyone's looking for a "fix", use this
https://github.com/MenBrial/vim-markdown/commit/6dc8d604316c41a8f69767050fd97cf80cfb585f