From 0d8d025698d51a7bc319b0e8bc9c545d8359377a Mon Sep 17 00:00:00 2001 From: GitKroz Date: Sun, 20 Sep 2015 23:58:04 +0200 Subject: [PATCH] Make MBE*All commands preserve current tab When multiple tabs open, MBE*All commands (for instance, MBECloseAll) makes the last tab active (effect of tabdo command). The change relies in saving current tab before command execution and recovering current tab after command execution. Tested on gvim 7.4, Windows. --- plugin/minibufexpl.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/minibufexpl.vim b/plugin/minibufexpl.vim index e2b3348..9bfe735 100644 --- a/plugin/minibufexpl.vim +++ b/plugin/minibufexpl.vim @@ -52,31 +52,31 @@ if !exists(':MBEFocus') command! MBEFocus call FocusExplorer() endif if !exists(':MBEFocusAll') - command! MBEFocusAll tabdo call FocusExplorer() + command! MBEFocusAll let s:currTab=tabpagenr() | tabdo call FocusExplorer() | exec "tabnext " . s:currTab endif if !exists(':MBEOpen') command! -bang MBEOpen let t:skipEligibleBuffersCheck = 1 | if '' == '!' | call StopExplorer(0) | endif | call StartExplorer(bufnr("%")) endif if !exists(':MBEOpenAll') - command! -bang MBEOpenAll tabdo let t:skipEligibleBuffersCheck = 1 | if '' == '!' | call StopExplorer(0) | endif | call StartExplorer(bufnr("%")) | let s:TabsMBEState = 1 + command! -bang MBEOpenAll let s:currTab=tabpagenr() | tabdo let t:skipEligibleBuffersCheck = 1 | if '' == '!' | call StopExplorer(0) | endif | call StartExplorer(bufnr("%")) | let s:TabsMBEState = 1 | exec "tabnext " . s:currTab endif if !exists(':MBEClose') command! -bang MBEClose let t:skipEligibleBuffersCheck = 0 | call StopExplorer('' == '!') endif if !exists(':MBECloseAll') - command! -bang MBECloseAll tabdo let t:skipEligibleBuffersCheck = 0 | call StopExplorer('' == '!') | let s:TabsMBEState = 0 + command! -bang MBECloseAll let s:currTab=tabpagenr() | tabdo let t:skipEligibleBuffersCheck = 0 | call StopExplorer('' == '!') | let s:TabsMBEState = 0 | exec "tabnext " . s:currTab endif if !exists(':MBEToggle') command! -bang MBEToggle call ToggleExplorer(0,''=='!') endif if !exists(':MBEToggleAll') - command! -bang MBEToggleAll call ToggleExplorer(1,''=='!') + command! -bang MBEToggleAll let s:currTab=tabpagenr() | call ToggleExplorer(1,''=='!') | exec "tabnext " . s:currTab endif if !exists(':MBEToggleMRU') command! -bang MBEToggleMRU call ToggleMRU() endif if !exists(':MBEToggleMRUAll') - command! -bang MBEToggleMRUAll tabdo call ToggleMRU() + command! -bang MBEToggleMRUAll let s:currTab=tabpagenr() | tabdo call ToggleMRU() | exec "tabnext " . s:currTab endif if !exists(':MBEbn') command! MBEbn call CycleBuffer(1)