SidOfc / mkdx

A vim plugin that adds some nice extra's for working with markdown documents

Home Page:https://www.vim.org/scripts/script.php?script_id=5620

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to toggle lines into numbered list?

jackywu opened this issue · comments

commented

Sorry to bother you, I have searched through the documents on GitHub and the help in Vim, but I couldn't find how to convert multiple lines into a numbered list. Could you please tell me how to do it?

PS. Thank you for your plugin, it really helped me a lot.

No problem, it seems that I did not build functionality like that actually. There are only toggle functions to convert to unordered list items / checklist items. It's been a while since I built those functions but I believe that I did not build a numbered list toggle due to the difference in complexity.

All the unordered list / checkbox markers require is a regular expression replace, whereas parsing a (maybe nested) list into a numbered list takes quite a bit more effort to do right.

Second part is that while building, I probably opted out of parsing into numbered lists since I myself use mostly unordered lists and thought I could wait until someone would request the feature.

Quite some time has passed though and I've since put mkdx on feature freeze due to the codebase being quite messy and complex so even while this feels like a natural addition I'm not sure how I feel about making an exception to this rule.

Cheers for trying mkdx though, glad you've liked it so far :)

commented

if you continue to improve this plugin in the future, that would be a greate news, as it is truly the best among all markdown plugins and it should only get better in the future.

I will leave this option open while I'm thinking about making an exception. In general I think mkdx would need a complete rewrite with some fresh tests. Mkdx was my first ever vim plugin in addition to struggling with understanding how the editor worked back then I also didn't write the best code so there are a fair amount of unsolved edge cases as well.

I've also switched to Neovim myself and while writing my own file explorer plugin in Lua using Neovim's Lua API I realized I much prefer writing Lua to VimScript so I was thinking that instead of rewriting mkdx in VimScript, I am better off building a better tested, simpler and much faster markdown plugin in Lua at the cost of being Neovim only.

commented

I will leave this option open while I'm thinking about making an exception. In general I think mkdx would need a complete rewrite with some fresh tests. Mkdx was my first ever vim plugin in addition to struggling with understanding how the editor worked back then I also didn't write the best code so there are a fair amount of unsolved edge cases as well.

I've also switched to Neovim myself and while writing my own file explorer plugin in Lua using Neovim's Lua API I realized I much prefer writing Lua to VimScript so I was thinking that instead of rewriting mkdx in VimScript, I am better off building a better tested, simpler and much faster markdown plugin in Lua at the cost of being Neovim only.

New vim also support lua plugin, looking forward your work

It seems so indeed but I am afraid that Vim's Lua API is not quite as extensive as Neovim's Lua API which provides a lot of extras which make writing plugins easy. Additionally I am not a fan of supporting two different Lua APIs as that will only cause pain from maintenance perspective (mkdx tries this in VimScript with some async features which "works" but is far from ideal).

Once both their Lua APIs are similar enough I could look into rewriting mkdx for both, but until then I am going to stick to Neovim's Lua API and therefor a Neovim only Lua plugin when I decide to rewrite mkdx.

Cheers for the heads up though, I hope both APIs will end up being the same in the end so that "Neovim only" plugins can become a thing of the past :)