Skip to content

Instantly share code, notes, and snippets.

@elentok
Created July 21, 2012 17:35
Show Gist options
  • Save elentok/3156512 to your computer and use it in GitHub Desktop.
Save elentok/3156512 to your computer and use it in GitHub Desktop.
Vim Google Search
func! WebSearch(url)
let searchterm = input('Search: ')
if searchterm != ''
let url = substitute(a:url, "%query%", searchterm, '')
call Browse(url)
end
endfunc
func! Browse(url)
if has('gui_win32')
call system("start " . a:url)
else
call system("/usr/bin/xdg-open '" . a:url . "' &")
end
endfunc
map ,g :call WebSearch("https://google.com/search?q=%query%")<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment