Mildly Internet
March 25, 2014 | code

Useful Vim Settings to Edit Markdown

Here’s some tips for improving your Vim setup to edit Markdown files.

Set width to 80 characters

By setting the textwidth option, Vim will automatically wrap lines to that width.

:set textwidth=80

You can also configure to automatically this setting to specific types of files

au BufRead,BufNewFile *.md setlocal textwidth=80

To reformat existing lines, select them in visual mode and press gq.

Enable Spellcheck

Avoid spelling mistakes in your markdown files and git commit messages with this handy option.

:setlocal spell

Have Vim always apply this setting:

autocmd BufRead,BufNewFile *.md setlocal spell