MeanderingProgrammer / markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
504 stars 20 forks source link

Fix checkbox indent #31

Closed masa0x80 closed 1 month ago

masa0x80 commented 1 month ago

It was good that the commit e38795f3641ffb5702bf289f76df8a81f6163d32 made the list markers invisible, but there was a problem with indentation broken when the list and checkboxes coexisted only by hiding the list markers.

Replacing the combination of list markers and checkboxes with the virtual text of the checkboxes solved the indentation problem.

before after
before after
MeanderingProgrammer commented 1 month ago

Hi, thanks for the PR!

I went about resolving this in a slightly different way in: https://github.com/MeanderingProgrammer/markdown.nvim/commit/258da4bcdecdc83318a515fc4c6c3e18c0c65a61.

Rather than overlaying with spaces I applied a conceal on the list marker before a checkbox, that way the entire line shifts over and we avoid the gap between the checkbox and the text.

I originally didn't like that when a cursor enters a line the concealed text pops back up, but turns out there is another option called concealcursor which lets us keep text concealed even when the cursor is on the line. Needed to make window options more configurable to do this, but that might be useful to have in either case.

Hope this does what you were looking for, I appreciate your time!