Simplify tab completion

This commit is contained in:
Tim Pope 2014-06-17 02:30:30 -04:00
parent c4713200f7
commit 2b05b275f5

View File

@ -655,10 +655,8 @@ function! s:GitComplete(A,L,P) abort
let cmds = map(split(glob(s:exec_path.'/git-*'),"\n"),'s:sub(v:val[strlen(s:exec_path)+5 : -1],"\\.exe$","")') let cmds = map(split(glob(s:exec_path.'/git-*'),"\n"),'s:sub(v:val[strlen(s:exec_path)+5 : -1],"\\.exe$","")')
if a:L =~ ' [[:alnum:]-]\+ ' if a:L =~ ' [[:alnum:]-]\+ '
return s:repo().superglob(a:A) return s:repo().superglob(a:A)
elseif a:A == ''
return sort(cmds+keys(s:repo().aliases()))
else else
return filter(sort(cmds+keys(s:repo().aliases())),'v:val[0:strlen(a:A)-1] ==# a:A') return filter(sort(cmds+keys(s:repo().aliases())), 'strpart(v:val, 0, strlen(a:A)) ==# a:A')
endif endif
endfunction endfunction