.vim/ftplugin/markdown.vim

Wed, 28 Jul 2021 01:25:16 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 28 Jul 2021 01:25:16 -0500
changeset 930
6edfe4c6ebe5
parent 657
628b4b962086
child 931
55c477df9d1b
permissions
-rw-r--r--

quick autohtml on write

368
91d4fb4e0a42 improve text editing experience?
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 runtime ftplugin/text.vim
657
628b4b962086 Use pandoc as markdown equalprg, use only 72 for text width
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
2 setl equalprg=pandoc\ -f\ markdown\ -t\ markdown
628b4b962086 Use pandoc as markdown equalprg, use only 72 for text width
Meredith Howard <mhoward@roomag.org>
parents: 368
diff changeset
3
930
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
4 let b:markdown_autohtml = 0
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
5
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
6 function! s:autohtml() abort
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
7 if get(b:, 'markdown_autohtml', 0)
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
8 silent !md2html -o "%:p.html" "%:p"
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
9 endif
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
10 endfunction
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
11
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
12 augroup Markdown
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
13 autocmd!
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
14 autocmd BufWritePost <buffer> call s:autohtml()
6edfe4c6ebe5 quick autohtml on write
Meredith Howard <mhoward@roomag.org>
parents: 657
diff changeset
15 augroup END

mercurial