asides-3

A long time ago, I wrote about a monitoring script that I whipped up to automatically refresh a browser window displaying an html file when the corressponding html/css file has been modified. Yesterday, I did something similar using a Vim autocommand that doesn’t incur the overhead of a separate monitoring script.

The use-case is this: I am writing documentation in Vim using reStructuredText markup and using Sphinx to generate html documentation out of those. The autocommand I ended up with is this:

au BufWritePost *.rst silent execute "!make html &>/dev/null &" | redraw!

This could be extended to incorporate the dcop/qdbus call to refresh the browser window, as in the earlier script.