From 3c8f69584efcfd3b14fb1380ace85b186e04c584 Mon Sep 17 00:00:00 2001 From: yasuda Date: Wed, 28 Sep 2022 17:56:34 +0900 Subject: [PATCH] Keep `match` highlight in window move --- autoload/winresizer.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/winresizer.vim b/autoload/winresizer.vim index d755387..8bddcf9 100644 --- a/autoload/winresizer.vim +++ b/autoload/winresizer.vim @@ -52,13 +52,17 @@ fun! winresizer#swapTo(direct) endfun fun! winresizer#swapWindow(to) - let curNum = winnr() - let curBuf = bufnr( "%" ) + let curNum = winnr() + let curBuf = bufnr( "%" ) + let curMatch = getmatches(curNum) exe a:to . "wincmd w" - let toBuf = bufnr( "%" ) + let toBuf = bufnr( "%" ) + let toMatch = getmatches(a:to) exe 'hide buf' curBuf exe curNum . "wincmd w" exe 'hide buf' toBuf + call setmatches(curMatch, a:to) + call setmatches(toMatch, curNum) exe a:to ."wincmd w" endfun