commit cfca94c723a62b17e678c67845dee4ae6465eb03 (tree)
parent edae34e02fdc487bbdd1a43fcb89aac99d59495c
Author: Tim Pope <code@tpope.net>
Date: Wed, 7 Aug 2019 17:31:08 -0400
Expand simple aliases in :Git
This lets you alias ca = `git commit -a` and have `:Git ca` call
`:Gcommit -a`.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -2109,6 +2109,11 @@ function! s:GitCommand(line1, line2, range, count, bang, mods, reg, arg, args) a
let cmd = s:StatusCommand(a:line1, a:line2, a:range, a:count, a:bang, a:mods, a:reg, '', [])
return (empty(cmd) ? 'exe' : cmd) . after
endif
+ let alias = get(s:Aliases(dir), args[0], '!')
+ if alias !~# '^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0])
+ call remove(args, 0)
+ call extend(args, split(alias, '\s\+'), 'keep')
+ endif
let name = substitute(args[0], '\%(^\|-\)\(\l\)', '\u\1', 'g')
if exists('*s:' . name . 'Subcommand')
try