preservim / vim-markdown

Markdown Vim Mode
4.69k stars 524 forks source link

List only insert list indent on text wrap but not <CR> #530

Closed thornycrackers closed 4 years ago

thornycrackers commented 4 years ago

Hello! I'm trying to get vim-markdown set up to do the following. When I write out a long line I'm trying to get the plugin to insert the spaces for the next line E.G

- This is the first element of the list but it goes beyond tw so
  it wraps and goes onto here
- second element

That's pretty easy with vim_markdown_new_list_item_indent=2 but the problem is when I hit enter on a line that is less that tw it will also insert that additional 2 spaces

before enter

- first element[cursor]

hit enter

- first element
  [cursor]

I know that I can hit <c-d> to pull the indent back but it's annoying because the majority of list items written are short so it happens everytime. I know this plugin provides indentexper=GetMarkdownIndent() and looking at the documentation for indentkeys it says:

A list of keys that, when typed in Insert mode, cause reindenting of the current line. 

So I thought if I update indentkeys format to not include 'o' then when I hit enter it wouldn't call the function and thus not indent but in fact the opposite happened where hitting enter would still insert 2 spaces but autowrapping from hitting tw would not autoindent. Maybe I'm just spending too much time looking at this but any on how to configure the plugin to perform like this would be very appreciated.

thornycrackers commented 4 years ago

For anyone else who's looking for solution I ended up using https://github.com/dkarter/bullets.vim for this behavior instead.