3

I want the indentation in markdown file as follows

 - [ ] Here is some text. When I press enter
 - [ ] <--- This entire thing should get populated. 

It means - [ ] should be copied onto the next line. I have tried setting comments variable in vim to accommodate the indentation for the same. I have tried installing multiple markdown plugins, but they don't seem to fix the indentation issue. Is there anyway we could do this ?

I would also be great if someone knows a plugin which could accomplish this too.

NOTE:- It should also work for nested lists as well.

1 Answer 1

3

A plugin that will accomplish what you are looking for is vim-orgmode. This will let you check and uncheck boxes in a convenient way.

You should also be able to achieve (most of) the functionality in question using Vim comments. Try clearing your comment settings if necessary

:set comments=

then doing

:set formatoptions+=cro
:set comments+=:-\ [\ ] 

Note the backslashes before the spaces, which you were probably missing. This will handle nested lists automatically based on the indent.

1
  • Thanks a lot. I knew about org mode, but I just didn't want to use it, because I didn't need that much functionality. I just wanted only that particular completion functionality. Didn't know that spaces need to be escaped! Aug 7, 2018 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.