Handle :Gmove paths consistently

This commit is contained in:
Tim Pope 2018-08-10 18:46:19 -04:00
parent 7ea21ca9ac
commit 597289e64d

View File

@ -2673,11 +2673,11 @@ endfunction
" Section: Gmove, Gremove " Section: Gmove, Gremove
function! s:Move(force, rename, destination) abort function! s:Move(force, rename, destination) abort
if a:destination =~# '^[.:]\=/' if a:destination =~# '^[.:]/'
let destination = substitute(a:destination[1:-1], '^[.:]\=/', '', '') let destination = a:destination[2:-1]
elseif a:destination =~# '^:(\%(top\|top,literal\|literal,top\|literal\))' elseif a:destination =~# '^:(\%(top\|top,literal\|literal,top\|literal\))'
let destination = matchstr(a:destination, ')\zs.*') let destination = matchstr(a:destination, ')\zs.*')
elseif a:rename elseif a:rename && a:destination !~# '^\a\+:\|^/'
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
else else
let destination = a:destination let destination = a:destination
@ -2707,7 +2707,7 @@ function! s:Move(force, rename, destination) abort
endfunction endfunction
function! s:RenameComplete(A,L,P) abort function! s:RenameComplete(A,L,P) abort
if a:A =~# '^\.\=/' if a:A =~# '^[.:]\=/'
return fugitive#PathComplete(a:A) return fugitive#PathComplete(a:A)
else else
let pre = '/' . fnamemodify(s:Relative(''), ':h') . '/' let pre = '/' . fnamemodify(s:Relative(''), ':h') . '/'