Make :GRename ./ and ../ respect parent dir of current file

References: https://github.com/tpope/vim-eunuch/issues/114
This commit is contained in:
Tim Pope
2024-12-29 02:17:31 -05:00
parent fcb4db52e7
commit 174230d6a7

View File

@@ -6769,7 +6769,6 @@ function! s:Move(force, rename, destination) abort
if destination !~# '^/\|^\a\+:' if destination !~# '^/\|^\a\+:'
let destination = s:Tree(dir) . '/' . destination let destination = s:Tree(dir) . '/' . destination
endif endif
let destination = s:Tree(dir) .
elseif a:destination =~# '^:(\%(top,literal\|literal,top\))' elseif a:destination =~# '^:(\%(top,literal\|literal,top\))'
let destination = s:Tree(dir) . matchstr(a:destination, ')\zs.*') let destination = s:Tree(dir) . matchstr(a:destination, ')\zs.*')
elseif a:destination =~# '^:(literal)\.\.\=\%(/\|$\)' elseif a:destination =~# '^:(literal)\.\.\=\%(/\|$\)'
@@ -6778,8 +6777,8 @@ function! s:Move(force, rename, destination) abort
let destination = simplify(default_root . matchstr(a:destination, ')\zs.*')) let destination = simplify(default_root . matchstr(a:destination, ')\zs.*'))
else else
let destination = s:Expand(a:destination) let destination = s:Expand(a:destination)
if destination =~# '^\.\.\=\%(/\|$\)' if destination =~# '^\.\.\=\%(/\|$\)' && !a:rename
let destination = simplify(getcwd() . '/' . destination) let destination = simplify((a:rename ? default_root : getcwd() . '/') . destination)
elseif destination !~# '^\a\+:\|^/' elseif destination !~# '^\a\+:\|^/'
let destination = default_root . destination let destination = default_root . destination
endif endif