Vinay Doma wrote:
I'd like to be able to delete a buffer in a tab, but still retain the
tab. Right now, Vim just closes the tab. Is there any way I can
configure Vim to do this?


Example,

vim file1.txt
:tabe file2.txt
:bd (closes file2.txt as well as the tab. I'd still like to retain
this empty tab.)


Thanks,
Vinay


You could just use :enew instead of :bd, which will leave you with a new, empty buffer. Unfortunately, the buffer will still be loaded in memory (:ls will show it). You could create a function, like the following:

:function! enewbd
   :let l:bufnum = bufnum($)
   :enew
   :bd l:bufnum
:endfunction

this function should fail if the current buffer is still not saved. It is effective a stronger version of :enew.
--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | <http://counter.li.org>

Reply via email to