Im using Markdown in Vim to write a lot of text. I’m wondering if its possible to make Vim automatically start the next line with a bullet * or – if I’m currently working on a text line in the list, and then presses enter ?
A lot of other text editors does this (e.g. Notational Velocity) so it would be great if this is possible in Vim as well.
What I want Vim to do:
- List element 1
- List element 2[press enter]
- (We are automatically here, with the bullet)
And I only want this for Markdown files.
Hope you understand! Thnx!
you need to set several vim variables to do it.
let’s take ‘-‘ as example:
here the last
'b:-'is important. it means, vim will think ‘-‘ and a space([tab] too) as comment leader, and will automatically added after you pressed Enter or o (normal mode). this set by:set formatoptions. see following lines.you could check
for details
here ‘r’ and ‘o’ are used for your requirement.
for details
EDIT
for adding markdown filetype. many resources on the net. simply gave a shot on google, got one:
http://technicalpickles.com/posts/using-markdown-in-vim/
change
auto settings above, should work.