From: Stefan Huber Date: Tue, 11 Dec 2018 12:28:33 +0000 (+0100) Subject: markdown: Add pandoc generation keymap X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=dffcffd5d9cc9f49219eb0855028af85a71fb25b;p=vimconf.git markdown: Add pandoc generation keymap --- diff --git a/keymaps.vim b/keymaps.vim index 39a61b0..4b27355 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -22,6 +22,7 @@ au Filetype c,cpp,objc map :FSHere au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards() au Filetype html,xml imap / +au Filetype markdown map :call RunPandoc() " Start interactive EasyAlign in visual mode (e.g. vipga) vmap (EasyAlign) diff --git a/macros.vim b/macros.vim index 55335b1..1397f0f 100644 --- a/macros.vim +++ b/macros.vim @@ -86,6 +86,17 @@ function AddIncludeGuards() endfunction +function RunPandoc() + " If pandoc.css exists, use it + let cssopts = "" + if findfile("pandoc.css", ".") == "pandoc.css" + let cssopts = "-c pandoc.css --self-contained" + endif + + execute ":!pandoc " . cssopts . " --toc " . @% . " -o " . @% . ".html" +endfunction + + if filereadable($HOME . '/.vim/macros-local.vim') source ~/.vim/macros-local.vim endif