mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-07 04:34:35 +08:00
Expand ~ and $VAR in :Git arguments
This commit is contained in:
@@ -1698,7 +1698,7 @@ function! s:BufName(var) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:ExpandVarLegacy(str) abort
|
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')
|
return substitute(a:str, '\\\ze[%#!]', '', 'g')
|
||||||
else
|
else
|
||||||
return a:str
|
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 buffer = s:BufName(len(a:other) > 1 ? '#'. a:other[1:-1] : '%')
|
||||||
let owner = s:Owner(buffer)
|
let owner = s:Owner(buffer)
|
||||||
return len(owner) ? owner : '@'
|
return len(owner) ? owner : '@'
|
||||||
|
elseif len(a:other)
|
||||||
|
return expand(a:other)
|
||||||
elseif a:var ==# '<cfile>'
|
elseif a:var ==# '<cfile>'
|
||||||
let bufnames = [expand('<cfile>')]
|
let bufnames = [expand('<cfile>')]
|
||||||
if v:version >= 704 && get(maparg('<Plug><cfile>', 'c', 0, 1), 'expr')
|
if v:version >= 704 && get(maparg('<Plug><cfile>', 'c', 0, 1), 'expr')
|
||||||
@@ -1804,7 +1806,7 @@ function! s:SplitExpandChain(string, ...) abort
|
|||||||
\ '\=s:DotRelative(s:Slash(simplify(getcwd() . "/" . submatch(0))), cwd)', '')
|
\ '\=s:DotRelative(s:Slash(simplify(getcwd() . "/" . submatch(0))), cwd)', '')
|
||||||
endif
|
endif
|
||||||
let arg = substitute(arg,
|
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')
|
\ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5), cwd)', 'g')
|
||||||
call extend(list, split(arg, "\1", 1))
|
call extend(list, split(arg, "\1", 1))
|
||||||
if arg ==# '--'
|
if arg ==# '--'
|
||||||
|
|||||||
Reference in New Issue
Block a user