My Vim installation recognizes the extension .md
as Modula.
The filetype (for syntax highlighting) can be changed via
:set filetype=markdown
In other files, a comment can be used to change this on a per-file basis.
But Markdown does not support comments (or deactivated lines), so this setting
would show up in the final document.
But the following setting in .vimrc
does the job:
au BufNewFile,BufRead *.md setlocal ft=markdown
Other useful settings:
imap <F5> <ESC>yypVr=o
imap <F6> <ESC>yypVr-o
Those two mappings set F5 and F6 to place equal-signs and dashes below
the current line.
It does so by copying yy
and pasting p
the current line,
then marking the whole line V
and replacing each character r=
.
To use this from input mode, it first issues ESC and finally o
to continue writing in the line below.
This helps a lot with the underlined type of headings.