sponsor Vim development Vim logo Vim Book Ad

markdown_autoformat.vim : Automatic formatting heuristics for Markdown

 script karma  Rating 5/4, Downloaded by 622  Comments, bugs, improvements  Vim wiki

created by
Tom Ryder
 
script type
ftplugin
 
description
This filetype plugin for Markdown documents ("markdown" filetype) attempts to apply the 'formatoptions' flag a for auto-format intelligently in three ways:

    Turn it on automatically on load if the buffer looks wrapped
    Suspend it if editing a line in a code block (indented by four spaces)
    Suspend it if pasting something with a linebreak in it

It defaults to doing all three, but that can be disabled with options.

The proper way to do this is with a formatexpr for Markdown, but a good one doesn't seem to exist yet. This plugin might eventually take the form of writing one.

https://sanctum.geek.nz/cgit/vim-markdown-autoformat.git
 
install details
This should probably be saved as ~/.vim/after/ftplugin/markdown/autoformat.vim (per the distribution layout) or ~/.vim/after/ftplugin/markdown_autoformat.vim (if you prefer), so that it definitely loads *after* the primary markdown.vim plugin. Put the autoload script in ~/.vim/autoload/markdown/autoformat.vim. Or, just use your favourite Vim plugin manager.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-markdown-autoformat-0.5.0.tar.gz 0.5.0 2018-09-06 7.0 Tom Ryder More efficient string matching
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github