Home

Awesome

vim-markdownfmt

Markdown formatting plugin for Vim. Designed to work with "gofmt-style" commands such as markdownfmt and mdfmt.

Installation

Vundle

If you use Vundle, add the following to your vimrc:

Plugin 'moorereason/vim-markdownfmt'

Then install with:

:PluginInstall

Pathogen

If you use Pathogen, do this:

cd ~/.vim/bundle
git clone https://github.com/moorereason/vim-markdownfmt.git

Options

Command Executable

Define which "fmt" executable you want to use. It must be in your PATH. Default is markdownfmt.

let g:markdownfmt_command = 'markdownfmt'

Command Options

Define options to be passed to command executable. Default is empty. Note that -w is always passed as an option.

let g:markdownfmt_options = ''

Autosave

Set whether to automatically run format command on save. Default is 0.

let g:markdownfmt_autosave=0

Fail Silently

Set whether to fail silently (1) or show errors (0). Default is 0 (show errors).

let g:markdownfmt_fail_silently=0

Key Bindings

If you decide to leave the autosave feature disabled, you can use a command like the following to format and save the current buffer.

au FileType markdown nmap <leader>s :<C-u>call markdownfmt#Format()<CR>

Credits

License

MIT License. See file LICENSE for more details.