" MBENeedNextWindow - From the MBE window, test window under the cursor {{{ " " If we are in our explorer, then we attempt to open the buffer under the " cursor in the previous window. " function!<SID>MBENeedNextWindow() if bufname('%') =='-MiniBufExplorer-'|| bufname('%') =='__Tag_List__'|| (g:miniBufExplModSelTarget ==1&& getbufvar(bufnr('%'), '&modifiable') ==0) return1 else return0 endif endfunction " }}} " MBESelectBuffer - From the MBE window, open buffer under the cursor {{{ " " If we are in our explorer, then we attempt to open the buffer under the " cursor in the previous window. " function!<SID>MBESelectBuffer() call <SID>DEBUG('===========================',10) call <SID>DEBUG('Entering MBESelectBuffer()' ,10) call <SID>DEBUG('===========================',10) " Make sure we are in our window if bufname('%') !='-MiniBufExplorer-' call <SID>DEBUG('MBESelectBuffer called in invalid window',1) return endif let l:save_rep =&report let l:save_sc =&showcmd let &report =10000 set noshowcmd let l:bufnr =<SID>GetSelectedBuffer() let l:resize =0 if(l:bufnr !=-1) " If the buffer exists. let l:saveAutoUpdate = g:miniBufExplorerAutoUpdate let g:miniBufExplorerAutoUpdate =0 " Switch to the previous window wincmd p let curbufname = bufname('%') " If we are in the buffer explorer or in a nonmodifiable buffer with " g:miniBufExplModSelTarget set then try another window (a few times) while<SID>MBENeedNextWindow() wincmd w if bufname('%') == curbufname break endif endwhile " The following handles the case where -MiniBufExplorer- " is the only window left. We need to resize so we don't " end up with a 1 or two line buffer. if bufname('%') =='-MiniBufExplorer-' let l:resize =1 endif exec('b! '.l:bufnr) if (l:resize) resize endif let g:miniBufExplorerAutoUpdate = l:saveAutoUpdate call <SID>AutoUpdate(-1) endif let &report = l:save_rep let &showcmd = l:save_sc call <SID>DEBUG('===========================',10) call <SID>DEBUG('Completed MBESelectBuffer()',10) call <SID>DEBUG('===========================',10) endfunction