Refresh Firefox on Vim save
vim.wikia.com
vim.wikia.com
autocmd BufWriteCmd *.html,*.css,*.haml :call Refresh_browser()
function()! Refresh_browser()
if &modified
write
silent !xdotool search --class google-chrome key ctrl+r
endif
endfunctionI think that's rather counter-intuitive, but I doubt it'd be much of an issue in practice.
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 tellNo vim hack required. However, this is my first hearing of MozRepl(out of the loop I know). I now have a bunch of ideas for interesting things that I can do with it, thanks!
For example, there are at least two "eproject" extensions for Emacs.
(On a side note, I wish I could use "Always on Top" in Windows. Anyone know if this is possible?)
Note: make sure to include .sass, .erb in your .vimrc if your using Sass and Rails. For example
autocmd BufWriteCmd *.html,*.css,*.gtpl,*.sass,*.erb :call Refresh_firefox()
2nd note: Make sure to start MozRepl:Go to Firefox Tools menu and select MozRepl → Start
Something like autotest for ruby projects, and cucumber / selenium etc should be making sure your code does what it is supposed to.
I do :w, Alt-Tab, Ctrl-R constantly when I'm doing design. I'm constantly testing little changes. This looks like it could be quite a useful little hack.
see this slide: http://www.slideshare.net/c9s/perlhacksonvim
Another hack I've put together is to use applescript and a keyboard shortcut. Set it up as a universal shortcut and give focus to your code editor at the end of the script.