Lim H.
Lim H.

Reputation: 10050

Vim - Stop buffer number to be automatically incremented everytime a buffer is closed

For example, I have buffer foo.c at b6. When I close it with bd and open bar.c I want bar.c to be at b6 instead of b7.

Thank you.

Upvotes: 1

Views: 223

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172520

That's not possible; the buffer numbers internally are incremented sequentially; there's no notion of "number reuse" in the current implementation. This would require a code change. An argument against this: Some plugins associate buffer-related information with the buffer number, too. If that number can point to a different buffer, those plugins would be confused.

The only way to get "clean" buffer numbers is to write a viminfo or session file, restart Vim, and reload those buffers.

Upvotes: 3

Related Questions