mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 13:23:52 -05:00
Tab complete Git aliases
This commit is contained in:
@@ -317,6 +317,28 @@ endfunction
|
|||||||
|
|
||||||
call s:add_methods('repo',['dirglob','superglob'])
|
call s:add_methods('repo',['dirglob','superglob'])
|
||||||
|
|
||||||
|
function! s:repo_config(conf) dict abort
|
||||||
|
return matchstr(system(s:repo().git_command('config').' '.a:conf),"[^\r\n]*")
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:repo_user() dict abort
|
||||||
|
let username = s:repo().config('user.name')
|
||||||
|
let useremail = s:repo().config('user.email')
|
||||||
|
return username.' <'.useremail.'>'
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:repo_aliases() dict abort
|
||||||
|
if !has_key(self,'_aliases')
|
||||||
|
let self._aliases = {}
|
||||||
|
for line in split(self.git_chomp('config','--get-regexp','^alias[.]'),"\n")
|
||||||
|
let self._aliases[matchstr(line,'\.\zs\S\+')] = matchstr(line,' \zs.*')
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return self._aliases
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:add_methods('repo',['config', 'user', 'aliases'])
|
||||||
|
|
||||||
function! s:repo_keywordprg() dict abort
|
function! s:repo_keywordprg() dict abort
|
||||||
let args = ' --git-dir='.escape(self.dir(),"\\\"' ").' show'
|
let args = ' --git-dir='.escape(self.dir(),"\\\"' ").' show'
|
||||||
if has('gui_running') && !has('win32')
|
if has('gui_running') && !has('win32')
|
||||||
@@ -518,9 +540,9 @@ function! s:GitComplete(A,L,P) abort
|
|||||||
if a:L =~ ' [[:alnum:]-]\+ '
|
if a:L =~ ' [[:alnum:]-]\+ '
|
||||||
return s:repo().superglob(a:A)
|
return s:repo().superglob(a:A)
|
||||||
elseif a:A == ''
|
elseif a:A == ''
|
||||||
return cmds
|
return sort(cmds+keys(s:repo().aliases()))
|
||||||
else
|
else
|
||||||
return filter(cmds,'v:val[0 : strlen(a:A)-1] ==# a:A')
|
return filter(sort(cmds+keys(s:repo().aliases())),'v:val[0:strlen(a:A)-1] ==# a:A')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -2160,18 +2182,6 @@ function! fugitive#statusline(...)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_config(conf) dict abort
|
|
||||||
return matchstr(system(s:repo().git_command('config').' '.a:conf),"[^\r\n]*")
|
|
||||||
endfun
|
|
||||||
|
|
||||||
function! s:repo_user() dict abort
|
|
||||||
let username = s:repo().config('user.name')
|
|
||||||
let useremail = s:repo().config('user.email')
|
|
||||||
return username.' <'.useremail.'>'
|
|
||||||
endfun
|
|
||||||
|
|
||||||
call s:add_methods('repo',['config', 'user'])
|
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" vim:set ft=vim ts=8 sw=2 sts=2:
|
" vim:set ft=vim ts=8 sw=2 sts=2:
|
||||||
|
|||||||
Reference in New Issue
Block a user