Auto-reload browser when I save changes to html file, in Chrome?

后端 未结 23 2068
半阙折子戏
半阙折子戏 2020-12-12 11:46

I\'m editing an HTML file in Vim and I want the browser to refresh whenever the file underneath changes.

Is there a plugin for Google Chrome that will listen for ch

23条回答
  •  时光取名叫无心
    2020-12-12 12:34

    Ok, here is my crude Auto Hotkey solution (On Linux, try Auto Key). When the save keyboard shortcut gets pressed, activate the browser, click the reload button, then switch back to the editor. Im just tired of getting other solutions running. Wont work if your editor does autosave.

    ^s::   ; '^' means ctrl key. '!' is alt, '+' is shift. Can be combined.
        MouseGetPos x,y
        Send ^s
    
        ; if your IDE is not that fast with saving, increase.
        Sleep 100
    
        ; Activate the browser. This may differ on your system. Can be found with AHK Window Spy.
        WinActivate ahk_class Chrome_WidgetWin_1
        WinWaitActive ahk_class Chrome_WidgetWin_1
        Sleep 100   ; better safe than sorry.
    
        ;~ Send ^F5   ; I dont know why this doesnt work ...
        Click 92,62   ; ... so lets click the reload button instead.
    
        ; Switch back to Editor. Can be found with AHK Window Spy.
        WinActivate ahk_class zc-frame
        WinWaitActive ahk_class zc-frame
        Sleep 100   ; better safe than sorry.
    
        MouseMove x,y
        return
    

提交回复
热议问题