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.

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.

  • 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! – Palash Ahuja Aug 7 '18 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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