I usually like to use buffer numbers to go to buffers quickly. Unfortunately, after many searches, opening some files, etc., the buffer numbers get crazy:
Thanks.
"the buffer numbers get crazy" Tell me about it! By the end of the day I'm easy over 100 buffers. But luckily, as you can see in this animation, you have tab completion for buffer names.
So, even though you can't renumber the buffers, you can still jump around easily.
It's also worth noting that it is doing *str*
matching so I didn't have to search on "se" to go straight to that file. Typing :b up
tab would have also taken me straight there. If there are more than one match, subsequent tabs will cycle over the matches (circularly). So, in this session I could cycle over my "test" files or my "py" files if I wished. This is BETTER than renumbering once you learn it!
It is not possible to assign buffer numbers manually, or reassign them for that matter. The only way to restart buffer numbering is to restart vim. You might be interested in the SelectBuf script.
Try bufferexplorer plugin for vim. It's also usefull to map some keys to Fx keys,here's an example:
"Bufexplorer mapings
nmap <F5> <Esc>:BufExplorer<cr>
vmap <F5> <esc>:BufExplorer<cr>
imap <F5> <esc>:BufExplorer<cr>
" F6 - previous buffer
nmap <F6> :bp<cr>
vmap <F6> <esc>:bp<cr>i
imap <F6> <esc>:bp<cr>i
" F7 - next buffer
nmap <F7> :bn<cr>
vmap <F7> <esc>:bn<cr>i
imap <F7> <esc>:bn<cr>i
I think I figured out a way to do this. Use mksession: {session_filename}
, close out your session, open {session_filename}, Look for the lines with badd {filename}
, add/edit/delete/arrange these lines, then open it again with vim -S {session_filename}
. The buffers will be in the new order. Be careful with deleting if it was a current or active file. I will be referenced in other places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With