Make :Gmove always relative to repository root
This commit is contained in:
parent
e0b770a9bd
commit
196e448375
@ -2066,10 +2066,7 @@ function! s:Move(force, rename, destination) abort
|
|||||||
elseif a:rename
|
elseif a:rename
|
||||||
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
|
let destination = fnamemodify(s:Relative(''), ':h') . '/' . a:destination
|
||||||
else
|
else
|
||||||
let destination = s:shellslash(fnamemodify(s:sub(a:destination,'[%#]%(:\w)*','\=expand(submatch(0))'),':p'))
|
let destination = a:destination
|
||||||
if destination[0:strlen(s:repo().tree())] ==# s:repo().tree('')
|
|
||||||
let destination = destination[strlen(s:repo().tree('')):-1]
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
if isdirectory(s:buffer().spec())
|
if isdirectory(s:buffer().spec())
|
||||||
setlocal noswapfile
|
setlocal noswapfile
|
||||||
@ -2099,9 +2096,7 @@ function! s:MoveComplete(A,L,P) abort
|
|||||||
if a:A =~# '^/'
|
if a:A =~# '^/'
|
||||||
return s:repo().superglob(a:A)
|
return s:repo().superglob(a:A)
|
||||||
else
|
else
|
||||||
let matches = split(glob(a:A.'*'),"\n")
|
return map(s:repo().superglob('/' . a:A), 'strpart(v:val, 1)')
|
||||||
call map(matches,'v:val !~# "/$" && isdirectory(v:val) ? v:val."/" : v:val')
|
|
||||||
return matches
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -199,11 +199,7 @@ that are part of Git repositories).
|
|||||||
|
|
||||||
*fugitive-:Gmove*
|
*fugitive-:Gmove*
|
||||||
:Gmove {destination} Wrapper around git-mv that renames the buffer
|
:Gmove {destination} Wrapper around git-mv that renames the buffer
|
||||||
afterward. The destination is relative to the current
|
afterward. Add a ! to pass -f.
|
||||||
directory except when started with a /, in which case
|
|
||||||
it is relative to the work tree. (This is a holdover
|
|
||||||
from before |:Grename| and will be removed.) Add a !
|
|
||||||
to pass -f.
|
|
||||||
|
|
||||||
*fugitive-:Grename*
|
*fugitive-:Grename*
|
||||||
:Grename {destination} Like |:Gmove| but operates relative to the parent
|
:Grename {destination} Like |:Gmove| but operates relative to the parent
|
||||||
|
Loading…
Reference in New Issue
Block a user