2

I'm using MiniBufExpl to manage buffers.

In my workflow, I usually work on one thing at a time. I'm opening some files, coding, enjoying. Then, I want to clear my workspace to start with new buffers. Today I'm doing :qa[!] and opening a new vim.

MBE provides a nice command that deletes the buffer without closing the window: :MBEbd, an improved :bdelete.

I could easily do a small vim function that takes :buffers and :MBEbd to remove every buffers. Thing is, indexes will stay the same. Yes I often use :b[N] (where N is my buffer index), this is fast with 1 to 6 buffers but becomes painful with 2 figures.

How may I reset a buffer index to improve my workflow?


A test case:

vim
isomething<ESC>
:enew
ielse<ESC>
:bd!
:enew
:ls

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 9 2015 15:38:59)

  • 2
    As far as I know, you can't. There was definitely no way up through vim 7.2 - I'm not completely up to date, but I doubt one has been added since then. – godlygeek Jun 26 '15 at 17:57
  • Do you have a technical explanation? I have the feeling that the buffer, even when deleted, is staying in memory. – soyuka Jun 27 '15 at 18:53
  • The buffer isn't staying in memory after a :bdelete, it's just that the deleted buffer numbers are never reused. In general, Vim just won't reuse a buffer number. – godlygeek Jun 29 '15 at 17:11
  • Is this not considered as a bug? Maybe I should ask on the mail list. – soyuka Jun 29 '15 at 18:05
  • No, it's not a bug, it's just a feature that doesn't exist. – godlygeek Jun 29 '15 at 21:41
0

You can make the process of restarting vim easier with sessions.

Save the session with :

:mksession!

Open a session with :

:so Session.vim

note : The buffer index will start at 2 (buffer 1 is used to source Session.vim)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.