From 0bd41bd387f8ca336011abe22f96f6774a1cd14e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 23 Aug 2021 01:25:19 -0400 Subject: [PATCH] Expand ~ and $VAR in :Git arguments --- autoload/fugitive.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 5b0e298..b694658 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1698,7 +1698,7 @@ function! s:BufName(var) abort endfunction function! s:ExpandVarLegacy(str) abort - if get(g:, 'fugitive_legacy_quoting', 1) + if get(g:, 'fugitive_legacy_quoting', 0) return substitute(a:str, '\\\ze[%#!]', '', 'g') else return a:str @@ -1717,6 +1717,8 @@ function! s:ExpandVar(other, var, flags, esc, ...) abort let buffer = s:BufName(len(a:other) > 1 ? '#'. a:other[1:-1] : '%') let owner = s:Owner(buffer) return len(owner) ? owner : '@' + elseif len(a:other) + return expand(a:other) elseif a:var ==# '' let bufnames = [expand('')] if v:version >= 704 && get(maparg('', 'c', 0, 1), 'expr') @@ -1804,7 +1806,7 @@ function! s:SplitExpandChain(string, ...) abort \ '\=s:DotRelative(s:Slash(simplify(getcwd() . "/" . submatch(0))), cwd)', '') endif let arg = substitute(arg, - \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\|^\~\w*\|\$\w\+\)\|' . s:expand, \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5), cwd)', 'g') call extend(list, split(arg, "\1", 1)) if arg ==# '--'