Is it possible to reset the sequence of indices that vim uses for file buffers?

8

1

As I open up new files inside vim, the buffer index seems to skip over arbitrary indices. I switch between buffers using b<buffer-index>, so it helps to have sequential indices for sanity/OCD sake. After a while, I just exit vim and load up the files I'm currently working on via CL and it orders them sequentially, but this is a pain when you have multiple sub-directory paths.

Can I reset the sequence or something?

leo

Posted 2011-12-27T17:56:17.300

Reputation: 337

Answers

11

No, not without restarting Vim. There are a number of reasons why they cannot be reset, some of them internal, some having to do with avoiding surprises with Vim scripts that store buffer numbers.

Are you aware that you can do ":buffer partial buffer name" to jump to another buffer, as long as the string you supply is unique?

Heptite

Posted 2011-12-27T17:56:17.300

Reputation: 16 267

vim-airline uses pseudo- buffer numbers then. – Paschalis – 2016-04-05T08:06:55.833

2Ah! Thanks for the tip, I didn't know :buffer worked with partial names. – leo – 2011-12-27T20:41:42.917

3

Creating a session (:mksession!), closing vim and opening the session (:so Session.vim) will reorder you indices starting from 2 (1 is used to source the session).

DaftWooly

Posted 2011-12-27T17:56:17.300

Reputation: 31