sgur
5/13/2013 - 4:20 PM

googlesuggest-complete-vim (https://github.com/mattn/googlesuggest-complete-vim) を &filetype で絞り込む変更

googlesuggest-complete-vim (https://github.com/mattn/googlesuggest-complete-vim) を &filetype で絞り込む変更

diff --git a/autoload/googlesuggest.vim b/autoload/googlesuggest.vim
index eb3ae37..3f652ab 100644
--- a/autoload/googlesuggest.vim
+++ b/autoload/googlesuggest.vim
@@ -68,12 +68,11 @@ function! googlesuggest#Complete(findstart, base)
   else
     " find months matching with "a:base"
     let ret = []
-    let res = webapi#http#get('http://suggestqueries.google.com/complete/search', {"client" : "youtube", "q" : a:base, "hjson" : "t", "hl" : g:googlesuggest_language, "ie" : "UTF8", "oe" : "UTF8" })
+    let res = webapi#http#get('http://suggestqueries.google.com/complete/search', {"client" : "youtube", "q" : &filetype . ' ' . a:base, "hjson" : "t", "hl" : g:googlesuggest_language, "ie" : "UTF8", "oe" : "UTF8" })
   let arr = webapi#json#decode(res.content)
     for m in arr[1]
-      call add(ret, m[0])
+      call add(ret, substitute(m[0], '^' . &filetype . '\s', '', 'g'))
     endfor
     return ret
   endif
 endfunction
-