Description
Problem
Many people are accustomed to certain behaviors when editing markdown files; for example, adding a list item on <CR>
when the cursor is at the end of an existing list item (see #12). Some of these are not well supported by the existing plugin commands or API.
Solution
Add a helpers
module that can be used for common behaviors. This module will be intended for use in the on_attach
callback of the plugin configuration when setting up mappings.
The initial module implementation can include a function that handles a <CR>
mapping for inserting list items. The behavior of this mapping should be:
- If the cursor is at the end of an existing list item, add a new list item.
- If the cursor is at the end of an empty list item, remove the empty list item and add a new line.
If there are other common behaviors for inserting list items on <CR>
that conflict with the above, the helper function can instead return a specialized function based on options provided when setting up the mapping.