Save then refresh browser shortcut trick command in editor

I use AutoHotKey for this kind of stuff, but I'm pretty new at it. The nice part is that you don't have to switch editors. AutoHotKey lets you do anything that you want (pretty much), but it's easiest to use it to do things you can do with a relatively rote series of keystrokes.

You'd write a script that you'd run at runtime. Then whenever you use your selected hotkey it executes the script (which can be made up of 'artificial' key-strokes).

An example script might be (THIS IS UNTESTED AND ASSUMES THAT THE LAST WINDOW YOU HAD OPEN WAS THE BROWSER, i.e.: that "AltTab" causes the browser to open):

!+s::           ;Binds the hot key to "Alt,Shift, S"
    Send ^+s    ;Pushes "Ctl,Shift, S"
    Send AltTab ;Pushes "Alt, Tab"
    Send F5     ;Pushes "F5"

EDIT 05/2020

I'd like to call out that nowadays there are much better options than this. Hot reloading is a solved problem by whatever build tool you're using (rollup, webpack, etc), or by whatever file server you're using to host your files locally (e.g. https://github.com/tapio/live-server).


There is also a free open-source plug-in for Notepad++ called RefreshBrowser that will refresh the browser when you save documents.

Tags:

Editor