aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin/markdown.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-04 22:30:25 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-04 22:30:25 +1200
commit814bb33ccdd984feb5766db401cc70f7452422c8 (patch)
treee009b2518b8ea0497ff8671e4a5cdb6ae258419c /vim/ftplugin/markdown.vim
parentCorrect a comment in ftplugin/php.vim (diff)
downloaddotfiles-814bb33ccdd984feb5766db401cc70f7452422c8.tar.gz
dotfiles-814bb33ccdd984feb5766db401cc70f7452422c8.zip
Make private copy of ftplugin/markdown.vim
Diffstat (limited to 'vim/ftplugin/markdown.vim')
-rw-r--r--vim/ftplugin/markdown.vim43
1 files changed, 43 insertions, 0 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