From dffcffd5d9cc9f49219eb0855028af85a71fb25b Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Tue, 11 Dec 2018 13:28:33 +0100 Subject: [PATCH] markdown: Add pandoc generation keymap --- keymaps.vim | 1 + macros.vim | 11 +++++++++++ 2 files changed, 12 insertions(+) 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 -- 2.39.5