Re: :bd should NOT close the Window
On Fri, May 12, 2006 at 03:02:54PM -0400, Alan G Isaac wrote: > On Fri, 12 May 2006, Salman Khilji apparently wrote: > > When you have a window split, issuing a :bd command > > closes the buffer AND one panes of the split window as > > well. > > Just leave it open. > To edit newfile.txt in it > :e newfile.txt > To then immediately get rid of oldfile.txt > :bd# ... and if you want an empty buffer, use :enew instead of :bd . As above, you can then do :bd# if you want. I guess I never use :bd myself, so maybe I am missing the point. HTH --Benji Fisher
Re: :bd should NOT close the Window
You can try my short script which does exactly what you want: http://www.vim.org/tips/tip.php?tip_id=1078 --Matt On Fri, May 12, 2006 at 08:38:24PM +0300, Yakov Lerner wrote: > On 5/12/06, Salman Khilji <[EMAIL PROTECTED]> wrote: > >When you have a window split, issuing a :bd command > >closes the buffer AND one panes of the split window as > >well. > > > >I like to have my maximized window split vertically in > >2 panes all the time and would NOT want the :bd > >command to close any of the panes. > > > >Can it be done? > > You can't make :bd a total no-op. But. You can try the > following trick to make the deteled buffer *re-appear*. > Buffer will flick but won't go away if you work out all > details of this. Here is the idea: > 1. hook the BufDelete autoevent. > 2. for your "undeletable" buffer(s), set some b: > variable, say b:undeletable to true. (you probably > won't want to make all buffers undeletable, only some). >3. In BufDelete event, check b:undeletable > flag. If the flag is on, then >4. create new buffer with same size, position, > contents, setting, and proper cursor position. > > I didn't try it, but i think it can be made to work. > You'll need to resolve many small details along > the way, like how to restore position, contents, > cursor, and settings of the deleted/restore buffer. > Note than undo history of the restores buffer > will be inevitably lost. > > Yakov
Re: :bd should NOT close the Window
On Fri, 12 May 2006, Salman Khilji apparently wrote: > When you have a window split, issuing a :bd command > closes the buffer AND one panes of the split window as > well. Just leave it open. To edit newfile.txt in it :e newfile.txt To then immediately get rid of oldfile.txt :bd# hth, Alan Isaac
Re: :bd should NOT close the Window
On 5/12/06, Salman Khilji <[EMAIL PROTECTED]> wrote: When you have a window split, issuing a :bd command closes the buffer AND one panes of the split window as well. I like to have my maximized window split vertically in 2 panes all the time and would NOT want the :bd command to close any of the panes. Can it be done? You can't make :bd a total no-op. But. You can try the following trick to make the deteled buffer *re-appear*. Buffer will flick but won't go away if you work out all details of this. Here is the idea: 1. hook the BufDelete autoevent. 2. for your "undeletable" buffer(s), set some b: variable, say b:undeletable to true. (you probably won't want to make all buffers undeletable, only some). 3. In BufDelete event, check b:undeletable flag. If the flag is on, then 4. create new buffer with same size, position, contents, setting, and proper cursor position. I didn't try it, but i think it can be made to work. You'll need to resolve many small details along the way, like how to restore position, contents, cursor, and settings of the deleted/restore buffer. Note than undo history of the restores buffer will be inevitably lost. Yakov