junegunn / gv.vim

A git commit browser in Vim
1.35k stars 54 forks source link

Fix tab completion with latest Fugitive #111

Closed tpope closed 2 years ago

tpope commented 2 years ago

Thanks for staying on top of the latest Fugitive API changes. I noticed glancing at the source that tab complete is also using a removed API. The fix is straightforward:

diff --git c/plugin/gv.vim i/plugin/gv.vim
index 5c5cc1e..84ef1a9 100644
--- c/plugin/gv.vim
+++ i/plugin/gv.vim
@@ -313,7 +313,7 @@ function! s:gv(bang, visual, line1, line2, args) abort
       let [opts1, paths1] = s:log_opts(a:bang, a:visual, a:line1, a:line2)
       let [opts2, paths2] = s:split_pathspec(gv#shellwords(a:args))
       let log_opts = opts1 + opts2 + paths1 + paths2
-      call s:setup(FugitiveConfigGet('remote.origin.url'))
+      call s:setup(FugitiveRemoteUrl())
       call s:list(log_opts)
       call FugitiveDetect(@#)
     endif
@@ -326,8 +326,4 @@ function! s:gv(bang, visual, line1, line2, args) abort
   endtry
 endfunction

-function! s:gvcomplete(a, l, p) abort
-  return fugitive#repo().superglob(a:a)
-endfunction
-
-command! -bang -nargs=* -range=0 -complete=customlist,s:gvcomplete GV call s:gv(<bang>0, <count>, <line1>, <line2>, <q-args>)
+command! -bang -nargs=* -range=0 -complete=customlist,fugitive#CompleteObject GV call s:gv(<bang>0, <count>, <line1>, <line2>, <q-args>)

I've also included a complementary tweak to Git remote URL retrieval to handle url.<prefix>.insteadOf.

junegunn commented 2 years ago

Thanks! Fixed on master. And thank you for all the Vim plugins you have created 🙇

Shane-XB-Qian commented 2 years ago

maybe using fugitive#LogComplete is more accurate, if want to complete some git options. though even fugitive#LogComplete, there is no e.g --since=.... such option got complete, but part supported anyway (than nothing).