Wiki: DebugInfo: DontCloseMyWindow


Detailed view of a page, which is probably more useful for debugging than anything else.

Querying backend directly for 'DontCloseMyWindow'

get_pagedata('DontCloseMyWindow')
 _cached_html 
transformedtext Object
(
    [_type] => pagetype_wikitext Object
        (
        )

    [_basepage] => DontCloseMyWindow
    [_content] => Array
        (
            [0] => <div class="wikitext"><h3>Challenge</h3>
<p class="tightenable top">When you have several windows laid out, and you use :bd, the window containing the buffer is closed; make it not do that.  The behavior should be the same as using :bd when there is only one window.</p>
<p class="tightenable">Required</p>
<ul><li class="tightenable bottom">If there are other buffers, edit one of them (I'm not sure what algo Vim uses for that).</li>
<li class="tightenable top">If it's the last buffer, replace with a new, empty buffer.</li>
</ul>
<p class="tightenable">Bonus</p>
<ul><li class="tightenable">Add an option for minibufexpl.vim with the effect that only &quot;eligible buffers&quot; will be used</li>
</ul>
<hr />
<h3>Solutions</h3>
<pre class="tightenable top">
&quot; :Bd &lt;buffernum&gt; - by FallingCow
command! -bang -nargs=? Bd call &lt;Sid&gt;BDel('&lt;bang&gt;', &lt;args&gt;)
function! &lt;Sid&gt;BDel(bang, ...)
  let curbuf = (a:0 ? a:1 : winbufnr(0))
  if (winbufnr(2) != -1)

    &quot; Find buffer to move to
    let otherbuf = 1
    while otherbuf &lt;= bufnr('$') &amp;&amp; (!buflisted(otherbuf) || !getbufvar(otherbuf, '&amp;modifiable') || otherbuf == curbuf)
      let otherbuf = otherbuf + 1
    endwhile
    if otherbuf &gt; bufnr('$')
      enew
      let otherbuf = winbufnr(0)
    endif

    &quot; Loop through windows looking for buffer to be removed
    while bufwinnr(curbuf) != -1
      exe &quot;norm &quot; . (bufwinnr(curbuf)) . &quot;\&lt;C-W&gt;\&lt;C-W&gt;&quot;
      exe &quot;b&quot; . otherbuf
    endwhile
  endif

  &quot; Delete old buffer
  exe &quot;bd&quot; . a:bang . &quot; &quot; . curbuf
endfunction</pre>
<hr />
<p class="tightenable top bottom">Sorry for spoiling the party, but i don't see the sense of rule 2.
So here's what i use: 
            [1] => cached_wikilink Object
                (
                    [_page] => DeleteBufferButHoldWindowOpen
                )

            [2] => 
(It closes the window on the second last buffer)
-- yahvu</p>
</div>

        )

    [_description] => When you have several windows laid out, and you use :bd, the window containing the buffer is closed; make it not do that.  The behavior should be the same as using :bd when there is only one window.
)
 hits  2290
get_versiondata('DontCloseMyWindow',20)
 %content  !!Challenge When you have several window ...
 author  85.181.242.28
 author_id  85.181.242.28
 is_minor_edit   
 markup  2
 mtime  1193679370
 pagetype  wikitext
 summary  noncompetitive spoiler
get_versiondata('DontCloseMyWindow',19)
 %content  !!Challenge When you have several window ...
 _supplanted  1193679370
 author  193.71.180.107
 author_id  193.71.180.107
 is_minor_edit   
 markup  2
 mtime  1193661116
 pagetype  wikitext
get_versiondata('DontCloseMyWindow',18)
 %content  !!Challenge When you have several window ...
 _supplanted  1193661116
 author  WikiWord
 author_id  WikiWord
 is_minor_edit   
 markup  2
 mtime  1186728100
 pagetype  wikitext
get_versiondata('DontCloseMyWindow',13)
 %content  !!Challenge When you have several window ...
 _supplanted  1183076229
 author  metacosm
 author_id  metacosm
 is_minor_edit   
 markup  2
 mtime  1100238149
 pagetype  wikitext

Copyright © 2007 RobertMelton.com