diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-05 12:42:21 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-05 12:42:21 +1200 |
commit | 96804727405411def5638697ae0bbdf063b86855 (patch) | |
tree | 2317d837a8d07e590c5e2227252492e805355379 /vim/ftplugin | |
parent | Add global options for markdown_autoformat.vim (diff) | |
download | dotfiles-96804727405411def5638697ae0bbdf063b86855.tar.gz dotfiles-96804727405411def5638697ae0bbdf063b86855.zip |
Add ftplugin infrastructure and comments
Preparing for spinoff release
Diffstat (limited to 'vim/ftplugin')
-rw-r--r-- | vim/ftplugin/markdown/autoformat.vim | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/vim/ftplugin/markdown/autoformat.vim b/vim/ftplugin/markdown/autoformat.vim index 4b7e2f77..aa805267 100644 --- a/vim/ftplugin/markdown/autoformat.vim +++ b/vim/ftplugin/markdown/autoformat.vim @@ -1,6 +1,14 @@ -" Only do this when not done yet for this buffer -" Also do nothing if 'compatible' enabled, or if no autocmd feature, or if Vim -" is too old to support the needed autocmd events +" +" markdown/autoformat.vim: Refine control over the 'formatoptions' flag 'a' +" for automatic formatting when editing Markdown documents: +" +" - 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 +" +" Author: Tom Ryder <tom@sanctum.geek.nz> +" License: Same as Vim itself +" if exists('b:did_ftplugin_markdown_autoformat') || &compatible finish endif @@ -15,9 +23,11 @@ endif " Turn on autoformatting if less than 5% of the buffer's lines meet all three " of these conditions: -" * Longer than 'textwidth' -" * Contains at least one space (not an unsplittable line) -" * Not a code block (indented with at least four spaces) +" +" - Longer than 'textwidth' +" - Contains at least one space (not an unsplittable line) +" - Not a code block (indented with at least four spaces) +" if !exists('*s:Load') function! s:Load() abort let l:width = &textwidth ? &textwidth : 79 |