marshallward / vim-restructuredtext

Syntax file for reStructuredText on Vim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide makeprg by default?

anntzer opened this issue · comments

Something like

setlocal makeprg=python\ -c\"import\ sys,subprocess,tempfile,webbrowser;tmp=tempfile.TemporaryDirectory();output=tmp.name+'/'+sys.argv[2]+'.html';subprocess.run(['rst2html5.py',sys.argv[1],output]);webbrowser.open(output,2)\"\ %\ %:t:r

allows one to type :make and get the rendered HTML output in a webbrowser. I think the default errorformat even works for syntax errors :)
(The lack of spaces in the python script is a bit ugly, but escaping each and every space with a backslash doesn't really improve things...)