Open idvorkin opened 4 years ago
I’d like ideas on how to debug this (via logs or something)
Pushing to top, I now have more insight on the repro. I tried debugging but this vimscript-fu is beyond my abilities :)
A: First, you need to also have:
Bundle 'plasticboy/vim-markdown'
B: Then you need to have a liquid front matter.
Now load a file that looks like this:
---
t:1
---
A
<!-- vim-markdown-toc GFM -->
- [Hello](#hello)
<!-- vim-markdown-toc -->
B
# Hello
Put your cursor on the line with text A, then :w
Your file will be reformatted as follows (TOC now moved below the B):
---
t:1
---
A
B
<!-- vim-markdown-toc GFM -->
- [Hello](#hello)
<!-- vim-markdown-toc -->
# Hello
Poke @mzlogin
@idvorkin I'm sorry but I can't reproduce your phenomenon. Would you please provide more details, like your complete vim settings.
Thank you for the help! Simplified vimrc
syntax on
function! SetupPlugins()
" Vundle setup
" Instructions @ https://github.com/VundleVim/Vundle.vim/blob/master/README.md
" git clone https://github.com/VundleVim/Vundle.vim %USERPROFILE%/vimfiles/bundle/vundle
" MAC - $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
filetype off
set rtp+=~/vimfiles/bundle/Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Markdown stuff
" *******************************
Bundle 'mzlogin/vim-markdown-toc'
" :GenTocGFM
" :UpdateToc
Bundle 'plasticboy/vim-markdown'
" :TOC - Generate a toc sidebar
" :VSize - Resize to 20
" ]] Next Header
" [[ Prev Header
call vundle#end() " required
endfunc
call SetupPlugins()
filetype plugin indent on " required
let g:vim_markdown_follow_anchor = 1 " ge will jump to anchor (TBD: Map to C-]
let g:vim_markdown_toc_autofit = 1 " Great for not wasting extra space
let g:vim_markdown_frontmatter = 1
set conceallevel=2
let g:vim_markdown_new_list_item_indent = 0
let g:vim_markdown_folding_level = 4
let g:vmt_list_item_char='-'
" Always enable softpencil
"By default, swap out all instances in a line during substitutions
set gdefault
"
" vim:foldmethod=indent:
I also observed a 100% repro if I load the file from disk and then do the save before making any other changes. @mzlogin
let g:vim_markdown_frontmatter = 1
If I remove this line, everything will work well. But I still don't know why.
Thx. If it's helpful, a theory I had (though didn't test) was folding is interfering with the view computations
I wondered if a different approach would help. Like instead of erase the toc guards, leave the guards, delete toc and re-insert toc.
I’m not sure what is going on or the exact repro. The symptom is sometimes the prettier gaurds that were around my toc marks move. A “phychic debugging” is the toc is written a few lines below it’s original line. I’ve tried a few things to isolate this, but haven’t found a consistent repro. I think it’s more likely if I hit save above the TOC, as opposed to below it, but sometimes I get a repro below as well. See video.