From 3c64ce8fb9fb5fda415e1e068028c3584ca2606d Mon Sep 17 00:00:00 2001 From: Ernie Rael Date: Thu, 14 Apr 2022 18:00:21 -0700 Subject: [PATCH] Keep same focused vim window after DirDiffNext/DirDiffPrev. --- plugin/dirdiff.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/dirdiff.vim b/plugin/dirdiff.vim index 2389f7a..236ca99 100644 --- a/plugin/dirdiff.vim +++ b/plugin/dirdiff.vim @@ -639,6 +639,7 @@ function! GetBaseDir(diffName) endfunction function! DirDiffNext() + let t_winid = win_getid() " If the current window is a diff, go down one call GotoDiffWindow() " if the current line is <= 6, (within the header range), we go to the @@ -649,13 +650,16 @@ function! DirDiffNext() endif silent! exe (b:currentDiff + 1) call DirDiffOpen() + call win_gotoid(t_winid) endfunction function! DirDiffPrev() + let t_winid = win_getid() " If the current window is a diff, go down one call GotoDiffWindow() silent! exe (b:currentDiff - 1) call DirDiffOpen() + call win_gotoid(t_winid) endfunction " For each line, we can perform a recursive copy or delete to sync up the