.vim/ftplugin/markdown.vim

Sun, 09 Jan 2022 15:17:13 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 09 Jan 2022 15:17:13 -0500
changeset 968
0db164e368c5
parent 931
55c477df9d1b
permissions
-rw-r--r--

keep shell stuff in one place, distinguish by ext

runtime ftplugin/text.vim
setl equalprg=pandoc\ -f\ markdown\ -t\ markdown

if !exists('b:markdown_autohtml')
  let b:markdown_autohtml = 0
endif

function! s:autohtml() abort
  if get(b:, 'markdown_autohtml', 0)
    silent !md2html -o "%:p.html" "%:p"
  endif
endfunction

augroup Markdown
  autocmd!
  autocmd BufWritePost <buffer> call s:autohtml()
augroup END

mercurial