From 174230d6a7f2df94705a7ffd8d5413e27ec10a80 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Dec 2024 02:17:31 -0500 Subject: [PATCH] Make :GRename ./ and ../ respect parent dir of current file References: https://github.com/tpope/vim-eunuch/issues/114 --- autoload/fugitive.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2073b36..97304c2 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -6769,7 +6769,6 @@ function! s:Move(force, rename, destination) abort if destination !~# '^/\|^\a\+:' let destination = s:Tree(dir) . '/' . destination endif - let destination = s:Tree(dir) . elseif a:destination =~# '^:(\%(top,literal\|literal,top\))' let destination = s:Tree(dir) . matchstr(a:destination, ')\zs.*') elseif a:destination =~# '^:(literal)\.\.\=\%(/\|$\)' @@ -6778,8 +6777,8 @@ function! s:Move(force, rename, destination) abort let destination = simplify(default_root . matchstr(a:destination, ')\zs.*')) else let destination = s:Expand(a:destination) - if destination =~# '^\.\.\=\%(/\|$\)' - let destination = simplify(getcwd() . '/' . destination) + if destination =~# '^\.\.\=\%(/\|$\)' && !a:rename + let destination = simplify((a:rename ? default_root : getcwd() . '/') . destination) elseif destination !~# '^\a\+:\|^/' let destination = default_root . destination endif