Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier gaurds move #62

Open
idvorkin opened this issue Mar 8, 2020 · 8 comments
Open

Prettier gaurds move #62

idvorkin opened this issue Mar 8, 2020 · 8 comments

Comments

@idvorkin
Copy link

idvorkin commented Mar 8, 2020

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.

A6D283B8-641C-40B9-A18F-8B1DE3337155

@idvorkin
Copy link
Author

idvorkin commented Mar 8, 2020

I’d like ideas on how to debug this (via logs or something)

@idvorkin
Copy link
Author

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

@idvorkin
Copy link
Author

Poke @mzlogin

@mzlogin
Copy link
Owner

mzlogin commented Feb 21, 2021

@idvorkin I'm sorry but I can't reproduce your phenomenon. Would you please provide more details, like your complete vim settings.

mac-os-x

@idvorkin
Copy link
Author

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:

@idvorkin
Copy link
Author

idvorkin commented Feb 21, 2021

I also observed a 100% repro if I load the file from disk and then do the save before making any other changes. @mzlogin

@mzlogin
Copy link
Owner

mzlogin commented Mar 5, 2021

let g:vim_markdown_frontmatter = 1

If I remove this line, everything will work well. But I still don't know why.

@idvorkin
Copy link
Author

idvorkin commented Mar 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants