Skip to content

Instantly share code, notes, and snippets.

@zachwill
Created March 8, 2012 16:42
Show Gist options
  • Save zachwill/2001993 to your computer and use it in GitHub Desktop.
Save zachwill/2001993 to your computer and use it in GitHub Desktop.
Reload Google Chrome from Vim
" Reload Google Chrome on Mac from Vim.
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
tell application "Google Chrome" to activate
"""
call(['osascript', '-e', browser])
EOF
endfunction
@zachwill
Copy link
Author

zachwill commented Mar 8, 2012

If you haven't used Vim functions before, you can map this like the following in your .vimrc:

" ,g to reload Google Chrome
map <leader>g :call ChromeReload()<CR>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment