From d9e881bd0fb7aabdcfeb415cc1fc9e003702f75f Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 13 Apr 2018 13:01:02 +0200 Subject: [PATCH] SignifyDiff: cd into dir of file All VCS assume slightly different things where things have to be if you're in this directory using that command etc. Changing to the directory of the current file avoids many pitfalls. --- autoload/sy/repo.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index daa0e0c..3b96bbd 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -260,8 +260,14 @@ function! sy#repo#diffmode() abort let ft = &filetype tabedit % diffthis - leftabove vnew - silent put =system(cmd) + let [cwd, chdir] = sy#util#chdir() + try + execute chdir fnameescape(b:sy_info.dir) + leftabove vnew + silent put =system(cmd) + finally + execute chdir fnameescape(cwd) + endtry silent 1delete diffthis set buftype=nofile bufhidden=wipe nomodified