Guest User

Untitled

a guest
Aug 10th, 2013
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.68 KB | None | 0 0
  1. " generate markdown on save
  2. autocmd BufWritePost *.markdown call RunMarkdown()
  3. autocmd BufEnter *.markdown call RunMarkdown()
  4. autocmd InsertLeave *.markdown nested update
  5.  
  6. function! RunMarkdown()
  7.     let l:htmlFile = "/tmp/" . shellescape(expand("%:t:r") . "_from_markdown.html")
  8.     let l:markdownFile = shellescape(expand("%:p"))
  9.     let l:htmlContent = shellescape('<\!DOCTYPE html><html><head><meta charset="UTF-8" /><link rel=stylesheet href="file:///Users/alex/github.css" /></head><body>')
  10.     let l:command = printf("silent !echo %s > %s && markdown %s >> %s && open -g %s", l:htmlContent, l:htmlFile, l:markdownFile, l:htmlFile, l:htmlFile)
  11.     execute l:command
  12. endfunction
Advertisement
Add Comment
Please, Sign In to add comment