Created
July 21, 2012 17:35
-
-
Save elentok/3156512 to your computer and use it in GitHub Desktop.
Vim Google Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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