diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/ftplugin/markdown.vim | 43 | ||||
-rw-r--r-- | vim/ftplugin/markdown/autoformat.vim (renamed from vim/after/ftplugin/markdown/autoformat.vim) | 6 | ||||
-rw-r--r-- | vim/ftplugin/markdown/spell.vim (renamed from vim/after/ftplugin/markdown/spell.vim) | 0 | ||||
-rw-r--r-- | vim/ftplugin/php.vim | 2 | ||||
-rw-r--r-- | vim/ftplugin/php/check.vim (renamed from vim/after/ftplugin/php/check.vim) | 0 |
5 files changed, 47 insertions, 4 deletions
diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim new file mode 100644 index 00000000..2bd27d14 --- /dev/null +++ b/vim/ftplugin/markdown.vim @@ -0,0 +1,43 @@ +" +" Replace Vim's stock Markdown filetype plugin, reimplementing only the part I +" actually need: the options settings. I don't use the folding, anyway. +" +" This is mostly because the stock file pulls in HTML's filetype plugins too, +" without providing a variable check to stop it. That causes absurd problems +" with defining HTML checkers/linters in the rest of my files. +" +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +" Support line continuation for this file +if &compatible + let s:cpoptions_save = &cpoptions + set cpoptions-=C +endif + +" Set comment/quote patterns +setlocal comments=fb:*,fb:-,fb:+,n:> +setlocal commentstring=>\ %s + +" Set format options +setlocal formatoptions+=tcqln +setlocal formatoptions-=ro + +" Set list format patterns +let &l:formatlistpat = '^\s*\d\+\.\s\+\' + \ .'\|^[-*+]\s\+\' + \ .'\|^\[^\ze[^\]]\+\]:' + +" Define how to undo this plugin's settings +let b:undo_ftplugin = 'setlocal comments<' + \ . '|setlocal commentstring<' + \ . '|setlocal formatoptions<' + \ . '|setlocal formatlistpat<' + +" Restore 'cpoptions' setting if we touched it +if exists('s:cpoptions_save') + let &cpoptions = s:cpoptions_save + unlet s:cpoptions_save +endif diff --git a/vim/after/ftplugin/markdown/autoformat.vim b/vim/ftplugin/markdown/autoformat.vim index 3f620691..80bd034c 100644 --- a/vim/after/ftplugin/markdown/autoformat.vim +++ b/vim/ftplugin/markdown/autoformat.vim @@ -18,7 +18,7 @@ endif " * Longer than 'textwidth' " * Contains at least one space (not an unsplittable line) " * Not a code block (indented with at least four spaces) -if !has('*s:Load') +if !exists('*s:Load') function! s:Load() abort let l:width = &textwidth ? &textwidth : 79 let l:count = 0 @@ -41,7 +41,7 @@ endif call s:Load() " Suspend auto-formatting when in a code block (four-space indent) -if !has('*s:Line') +if !exists('*s:Line') function! s:Line() abort if getline('.') =~# '\m^ ' if &formatoptions =~# '\ma' @@ -62,7 +62,7 @@ augroup ftplugin_markdown_autoformat augroup END " Suspend auto-format when pasting anything with a linebreak -if !has('*s:Put') +if !exists('*s:Put') function! s:Put(above) abort let l:suspended = 0 if &formatoptions =~# '\ma' && getreg() =~# '\m\n' diff --git a/vim/after/ftplugin/markdown/spell.vim b/vim/ftplugin/markdown/spell.vim index 05fc7c00..05fc7c00 100644 --- a/vim/after/ftplugin/markdown/spell.vim +++ b/vim/ftplugin/markdown/spell.vim diff --git a/vim/ftplugin/php.vim b/vim/ftplugin/php.vim index b545e18a..39cec4b1 100644 --- a/vim/ftplugin/php.vim +++ b/vim/ftplugin/php.vim @@ -1,6 +1,6 @@ " " Replace Vim's stock PHP filetype plugin, reimplementing only the part I -" actually need (the matchit.vim keyword pairs). +" actually need: the matchit.vim keyword pairs. " " This is mostly because the stock file pulls in HTML's filetype plugins too, " without providing a variable check to stop it. That causes absurd problems diff --git a/vim/after/ftplugin/php/check.vim b/vim/ftplugin/php/check.vim index 33077a72..33077a72 100644 --- a/vim/after/ftplugin/php/check.vim +++ b/vim/ftplugin/php/check.vim |