From 4e279ca975a941b7650f8a56d629dd24ed29c2bb Mon Sep 17 00:00:00 2001 From: yasuda Date: Thu, 2 Sep 2021 13:07:08 +0900 Subject: [PATCH 1/3] Force create new window on split / vsplit / tab open type --- autoload/fuf.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/fuf.vim b/autoload/fuf.vim index fe9e6eb..b6fba90 100644 --- a/autoload/fuf.vim +++ b/autoload/fuf.vim @@ -142,10 +142,10 @@ function fuf#openBuffer(bufNr, mode, reuse) return endif execute printf({ - \ s:OPEN_TYPE_CURRENT : '%sbuffer' , - \ s:OPEN_TYPE_SPLIT : '%ssbuffer' , - \ s:OPEN_TYPE_VSPLIT : 'vertical %ssbuffer', - \ s:OPEN_TYPE_TAB : 'tab %ssbuffer' , + \ s:OPEN_TYPE_CURRENT : '%sbuffer' , + \ s:OPEN_TYPE_SPLIT : 'split | %sbuffer' , + \ s:OPEN_TYPE_VSPLIT : 'vsplit | %sbuffer', + \ s:OPEN_TYPE_TAB : 'tabe | %sbuffer' , \ }[a:mode], a:bufNr) endfunction From cb68b1e0a82dc3c92f1674ea82ed3ce97fe5220e Mon Sep 17 00:00:00 2001 From: yasuda Date: Thu, 11 Nov 2021 12:28:45 +0900 Subject: [PATCH 2/3] Fix to move to the current window in non-reuseWindow mode --- autoload/fuf.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoload/fuf.vim b/autoload/fuf.vim index b6fba90..bc74576 100644 --- a/autoload/fuf.vim +++ b/autoload/fuf.vim @@ -141,6 +141,9 @@ function fuf#openBuffer(bufNr, mode, reuse) \ l9#moveToBufferWindowInOtherTabpage(a:bufNr))) return endif + if exists('s:currentWin') && type(s:currentWin) == v:t_number + exec s:currentWin . 'wincmd w' + endif execute printf({ \ s:OPEN_TYPE_CURRENT : '%sbuffer' , \ s:OPEN_TYPE_SPLIT : 'split | %sbuffer' , @@ -378,6 +381,7 @@ function fuf#launch(modeName, initialPattern, partialMatching) endif call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, s:oneTimeVariables) let s:oneTimeVariables = [] + let s:currentWin = winnr() call s:activateFufBuffer() augroup FufLocal autocmd! @@ -884,6 +888,9 @@ function s:handlerBase.onInsertLeave() call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, tempVars) call fuf#launch(self.reservedMode, self.lastPattern, self.partialMatching) endif + if exists('s:currentWin') + unlet s:currentWin + endif endfunction " From 47a70f14b9879c5c191ab8709b2c8a9890412dbe Mon Sep 17 00:00:00 2001 From: yasuda Date: Fri, 12 Nov 2021 18:01:24 +0900 Subject: [PATCH 3/3] Fix window moving back timing to follow fuf abort (Esc) case --- autoload/fuf.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/fuf.vim b/autoload/fuf.vim index bc74576..7586ded 100644 --- a/autoload/fuf.vim +++ b/autoload/fuf.vim @@ -141,9 +141,6 @@ function fuf#openBuffer(bufNr, mode, reuse) \ l9#moveToBufferWindowInOtherTabpage(a:bufNr))) return endif - if exists('s:currentWin') && type(s:currentWin) == v:t_number - exec s:currentWin . 'wincmd w' - endif execute printf({ \ s:OPEN_TYPE_CURRENT : '%sbuffer' , \ s:OPEN_TYPE_SPLIT : 'split | %sbuffer' , @@ -878,6 +875,12 @@ function s:handlerBase.onInsertLeave() call s:deactivateFufBuffer() call fuf#saveDataFile(self.getModeName(), 'stats', self.stats) execute self.windowRestoringCommand + if exists('s:currentWin') + if type(s:currentWin) == v:t_number + exec s:currentWin . 'wincmd w' + unlet s:currentWin + endif + endif let fOpen = exists('s:reservedCommand') if fOpen call self.onOpen(s:reservedCommand[0], s:reservedCommand[1]) @@ -888,9 +891,6 @@ function s:handlerBase.onInsertLeave() call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, tempVars) call fuf#launch(self.reservedMode, self.lastPattern, self.partialMatching) endif - if exists('s:currentWin') - unlet s:currentWin - endif endfunction "