Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " generate markdown on save
- autocmd BufWritePost *.markdown call RunMarkdown()
- autocmd BufEnter *.markdown call RunMarkdown()
- autocmd InsertLeave *.markdown nested update
- function! RunMarkdown()
- let l:htmlFile = "/tmp/" . shellescape(expand("%:t:r") . "_from_markdown.html")
- let l:markdownFile = shellescape(expand("%:p"))
- let l:htmlContent = shellescape('<\!DOCTYPE html><html><head><meta charset="UTF-8" /><link rel=stylesheet href="file:///Users/alex/github.css" /></head><body>')
- let l:command = printf("silent !echo %s > %s && markdown %s >> %s && open -g %s", l:htmlContent, l:htmlFile, l:markdownFile, l:htmlFile, l:htmlFile)
- execute l:command
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment