From cfca94c723a62b17e678c67845dee4ae6465eb03 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 7 Aug 2019 17:31:08 -0400 Subject: [PATCH] Expand simple aliases in :Git This lets you alias ca = `git commit -a` and have `:Git ca` call `:Gcommit -a`. --- autoload/fugitive.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index b6fd9cd..28705bd 100644 --- 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