I am trying to do some small html web stuff, and would find it incredibly useful to be able to see live updates of the html file viewed through a browser whenever I save my file. I know there are probably IDEs out there that do this for you, and if you recommend any, please do, but I am looking to make a script that will just open the file in the browser, while closing the version of the file that was already open, so that I can continue to do all my programming in vim.
I know that I can use the following in Mac OSX, to open the file into a new tab of my current browser:
open foo.html
but, if I have this occurring on a timed loop, or every time I write (:w) in vim, my browser will fill up with new tabs. Is there a way to close the old tab when opening the new tab? Or is there an even better approach to this that I have not considered? It would be highly preferred if I could continue to use vim in terminal.
Thanks in advance.