diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 08695ad..58634b4 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1814,6 +1814,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 a:other =~# '^\~[~.]$' + return s:Slash(getcwd()) elseif len(a:other) return expand(a:other) elseif a:var ==# '' @@ -1882,13 +1884,13 @@ function! s:Expand(rev, ...) abort let file = a:rev endif return substitute(file, - \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\|^\~[~.]\)\|' . s:expand, \ '\=tr(s:ExpandVar(submatch(1),submatch(2),submatch(3),"", a:0 ? a:1 : getcwd()), "\1", " ")', 'g') endfunction function! fugitive#Expand(object) abort return substitute(a:object, - \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\|^\~[~.]\)\|' . s:expand, \ '\=tr(s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5)), "\1", " ")', 'g') endfunction @@ -1909,7 +1911,7 @@ function! s:SplitExpandChain(string, ...) abort \ '\=s:DotRelative(s:Slash(simplify(getcwd() . "/" . submatch(0))), cwd)', '') endif let arg = substitute(arg, - \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\|^\~\w*\|\$\w\+\)\|' . 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 ==# '--'