Skip to content

kizza/vim-reorder-buffers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reorder your vim buffers

Tests

The vim buffer list is immutable - and there's lots of context to how and why. Ultimately however there are numerous reasons where you want to move them around.

This plugin achieves reordering while adhering to the immutability - specifically it quite literally closes buffers and re-opens them in such a way as to be seamless (pretty much) for most use cases. Specifically I'm using vim-buftabline below to visualise my buffers - and I wanted to be able to rearrange them from time to time.

Example

How to use it

The plugin provides two commands :ShiftBufferLeft and :ShiftBufferRight. These two do essentially what you expect.

Bindings

For the best experience you may wish to add some bindings to call these. I find that leaning into the natural gt and gT tab navigation works well (with a prefixed <leader>)

nnoremap <silent><leader>gT :ShiftBufferLeft<CR>
nnoremap <silent><leader>gt :ShiftBufferRight<CR>

Auto-saving buffers

Given the plugin closes buffers to reopen them... unsaved buffers present a problem. By default the plugin will warn (and do nothing) if there are unsaved buffers, or you can set the following to auto-save them by default.

let g:reorder_buffers_allow_auto_save = v:true

About

Reorder you vim mutable vim buffers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published