Skip to content

Instantly share code, notes, and snippets.

@aasmith
Created December 11, 2012 21:53
Show Gist options
  • Save aasmith/4262584 to your computer and use it in GitHub Desktop.
Save aasmith/4262584 to your computer and use it in GitHub Desktop.
Reload safari when vim saves (OSX)
tell application "Safari"
activate
do JavaScript "window.location.reload();" in first document
end tell
tell application "MacVim" to activate
" Place this in your ~/.vimrc
" Reload Safari page when saving html css, etc on OSX
autocmd BufWriteCmd *.html,*.css,*.haml :call Refresh_browser()
function! Refresh_browser()
if &modified
write
silent !osascript ~/.vim/refresh.applescript
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment