5 ms·
If you're on Linux and use a different browser you can do the same using xdotool. autocmd BufWriteCmd *.html,*.css,*.haml :call Refresh_browser() funct
by vault_ 16y ago
If you're on Linux and use a different browser you can do the same using xdotool.
autocmd BufWriteCmd *.html,*.css,*.haml :call Refresh_browser()
function()! Refresh_browser()
if &modified
write
silent !xdotool search --class google-chrome key ctrl+r
endif
endfunction
- jamesbritt 16y agoWon't that refresh all instances of Chrome?
- vault_ 16y agoYou'd think so, but when I was doing some quick testing with just one window and multiple tabs it only refreshed the current tab. Doing some more tests now with multiple windows, it seems to only refresh the active tab of the back-most window in the stack. I think that's rather counter-intuitive, but I doubt it'd be much of an issue in practice.
- owyn 16y agoAnd if you are on a mac, you can do something like this instead of the xdotool line: silent !osascript ~/.vim/refresh.scpt Where refresh.scpt looks like this: tell application "Safari" activate set rURL to URL of current tab of front window set URL of current tab of front window to rURL end tell Or like this (this form preserves the location on the page) tell application "Safari" activate end tell tell application "System Events" tell process "Safari" keystroke "r" using {command down} end tell end tell