I messed with this a bit and finally came up with:
:bp | sp | bn | bd
Here's the copy/paste version for key mapping:
:bp<bar>sp<bar>bn<bar>bd<CR>
I've tested it a fair bit and it works consistently in various conditions. When used on the last buffer it will leave you with a new blank buffer.
Throw this in your .vimrc:
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
Restart Vim, or just :source ~/.vimrc
for changes to take effect. Next time you want to close a buffer just type: q
(if
is your leader key)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…