SidOfc / mkdx

A vim plugin that adds some nice extra's for working with markdown documents
https://www.vim.org/scripts/script.php?script_id=5620
MIT License
482 stars 13 forks source link

Re-numbering the numbered list doesn't work in indented lines. #192

Closed riodelphino closed 1 year ago

riodelphino commented 1 year ago

This is a nice plugin ! Thanks for your effort !

I have a situation like below.

MacOSX Ventura neovim v0.10.0

Reproduce steps:

According to this, https://github.com/SidOfc/mkdx/blob/master/README.md#inserting-list-items

Create numbered list, each line has 3-spaces indents. (shiftwidth=3)

   1. Heading1
   2. Heading2
   3. Heading3|

'|' is the cursor position (Normal mode). Then, hit 'Tab' key.

Expected:

   1. Heading1
   2. Heading2
      2.1. Heading3|

'3.' is re-numbered to 2.1.

Actual:

   1. Heading1
   2. Heading2
      3. Heading3|

'3.' is not re-numbered.

Removing indentations makes it work. When I remove all indentations, the re-numbering function works.

So now I'm doing like... remove the indents, hit tab key, then add indents again ^^;

And I want to keep indents in markdown file to make it easier to see.

Thank you.

SidOfc commented 1 year ago

Hello @riodelphino,

Hmn yeah initially the implementation only supported non-indented lists (that is, the first list item could not have an indent). I've tweaked the implementation a bit and it seems to work for both unindented lists as well as indented ones now.

Feel free to comment if you've indentified new issues as a result of this. Cheers!

riodelphino commented 1 year ago

Thanks for your quick work & reply !!

I updated the plugin. Now it also works with indented lines !

I have another question around this. How can I add auto numbered new line after like '2.1' ? I tried to hit the keys 'o' or 'Enter' in normal mode, 'Enter' or 'Shift-Enter' in insert mode, but they don't work. I can't find how in the documents.

SidOfc commented 1 year ago

I would check if some other plugin isn't interfering with mkdx in this case. When I tested in isolation all options worked.

Note that shift+enter is not intended to insert new list items but to continue with the current list item on a new line.

riodelphino commented 1 year ago

Thank you ^^ You are exactly right. I still kept other markdown plugin (mkdnflow) on, so I turn it off. It works properly now !