bswap.vim gives the ability to easily rearrange or navigate buffers in split windows.
By default, nothing is mapped for you. Feel free to call the functions or map to your own mappings
The exported functions are :SwapBuffer
, :NavBuffer
, and :DeleteBuffer
.
nnoremap <leader>ne :NavBuffer<CR>
nnoremap <leader>nn :SwapBuffer<CR>
nnoremap <leader>nd :DeleteBuffer<CR>
SwapBuffer will label all the open buffers (except the current buffer) with an alphanumeric character. Enter the character to swap the current buffer and the selected buffer. The cursor will remain in the same window, with the selected buffer contents.
NavBuffer will do the exact same as SwapBuffer, except it will send you to that buffer and not swap the contents.
DeleteBuffer is a convenience wrapper around :bdelete
. It labels all the open windows except the current one, and you select the one in which to delete.
Just one option, g:bswap_color
. Look at :so $VIMRUNTIME/syntax/hitest.vim
and select a color to change it to if the default does not suit you.
Currently, it's set to "Search". Override it with let g:bswap_color = "SomeOtherColor"
A lot of this is borrowed from some useful functionality I liked from Coc-Explorer