init: Set tabpagemax to 100
[vimconf.git] / macros.vim
index 55335b1bdb720543c68e54104181e60fc318a2ba..cba6b844c37b1578f3d811bac9626e10b69e0e0a 100644 (file)
@@ -86,6 +86,33 @@ function AddIncludeGuards()
 endfunction
 
 
+function RunPandoc()
+  " If pandoc.css exists, use it
+  let cssopts = ""
+  if findfile("pandoc.css", ".") == "pandoc.css"
+    let cssopts = "-c pandoc.css"
+  endif
+
+  execute ":!pandoc " . cssopts . " --self-contained --toc '" . @% . "' -o '" . @% . "'.html"
+endfunction
+
+function RunMarkdownpy(prog)
+  execute ":!" . a:prog . " " . @% . " > " . @% . ".html"
+endfunction
+
+function RunMarkdown()
+  if executable("pandoc")
+    call RunPandoc()
+  elseif executable("markdown2")
+    call RunMarkdownpy("markdown2")
+  elseif executable("markdown_py")
+    call RunMarkdownpy("markdown_py")
+  else
+    echo "No markdown implementation found."
+  endif
+endfunction
+
+
 if filereadable($HOME . '/.vim/macros-local.vim')
   source ~/.vim/macros-local.vim
 endif