Skip to content

Instantly share code, notes, and snippets.

@yaasita
Created June 28, 2014 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaasita/a82d949e0b0c9f45ed99 to your computer and use it in GitHub Desktop.
Save yaasita/a82d949e0b0c9f45ed99 to your computer and use it in GitHub Desktop.
set completefunc=GoogleComplete
function! GoogleComplete(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '\S'
let start -= 1
endwhile
return start
else
let ret = system('curl -s -G --data-urlencode "q='
\ . a:base . '" "http://suggestqueries.google.com/complete/search?&client=firefox&hl=ja&ie=utf8&oe=utf8"')
let res = split(substitute(ret,'\[\|\]\|"',"","g"),",")
return res
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment