I want to implement something similar to Org mode M-RET into neovim. In Org mode it creates new list item or heading depending on what line the point is on.
I'm thinking of a mapping in neovim that copies everything from the beginning of the current line until the first alphanumeric character of the line and puts it on a new line. For example, with cursor at the end, it would transform this:
* list item * inner list item
* list item * inner list item *
I think it could be done with
:s but i couldn't make it work (
:s/(^[^\w]*)(.*)/\1\2\n\1) and it would replace the whole line, which is unnecessary.
Ideally it should work in insert mode and shouldn't rewrite any registers.