Skip to content

Instantly share code, notes, and snippets.

@aliou
Forked from brettbuddin/docksend.vim
Created April 12, 2012 18:31
Show Gist options
  • Save aliou/2369894 to your computer and use it in GitHub Desktop.
Save aliou/2369894 to your computer and use it in GitHub Desktop.
Reload Google Chrome from Vim
function! ChromeReload()
let applescript = "-e \"tell application \\\"Google Chrome\\\" to tell the active tab of its first window \r
\reload \r
\end tell \r
\tell application \\\"Google Chrome\\\" to activate\""
silent exec "!osascript " . applescript
endfunction
command! ChromeReload call ChromeReload()
@aliou
Copy link
Author

aliou commented Apr 12, 2012

Like the @zachwill's version, this reloads the active tab of Chrome. However, instead of passing the Applescript to Python, it just sends it as a regular shell command, meaning that if your VIM isn't compiled with a language, this script will work (provided that you are using OS X). To launch it more easily, you can map it:

" ,g to reload Google Chrome
nnoremap <leader>g :ChromeReload<CR>

Also, if your into submodules in your VIM config, you can also add this as a submodule, since all gist are actually git repos:

# In the root of your git repo: 
git submodule add git://gist.github.com/2369894.git path/to/your/submodules/folder/ChromeReload-vim

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