markdown: Add pandoc generation keymap
[vimconf.git] / macros.vim
index 55335b1bdb720543c68e54104181e60fc318a2ba..1397f0f3f580b08d579c5c564cb5cebada048d98 100644 (file)
@@ -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