From 188692556a025db6ad4c7324961253469979b348 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Jun 2014 10:58:41 -0400 Subject: [PATCH] Fix subcommand complete when cursor mid-line --- plugin/fugitive.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index f5ff9dd..c84b476 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -655,12 +655,12 @@ function! fugitive#git_commands() abort return map(split(glob(s:exec_path.'/git-*'),"\n"),'s:sub(v:val[strlen(s:exec_path)+5 : -1],"\\.exe$","")') endfunction -function! s:GitComplete(A,L,P) abort - let cmds = fugitive#git_commands() - if a:L =~ ' [[:alnum:]-]\+ ' - return s:repo().superglob(a:A) - else +function! s:GitComplete(A, L, P) abort + if strpart(a:L, 0, a:P) !~# ' [[:alnum:]-]\+ ' + let cmds = fugitive#git_commands() return filter(sort(cmds+keys(s:repo().aliases())), 'strpart(v:val, 0, strlen(a:A)) ==# a:A') + else + return s:repo().superglob(a:A) endif endfunction