Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Delete current buffer in Vim without closing its split.
function! s:Bdelete(bang) abort
let l:current_buffer = bufnr("%")
let l:alternate_buffer = bufnr("#")
if buflisted(l:alternate_buffer)
execute "buffer" . a:bang . " #"
else
execute "bnext" . a:bang
endif
if bufnr("%") == l:current_buffer
new
endif
if buflisted(l:current_buffer)
execute "bdelete" . a:bang . " " . l:current_buffer
endif
endfunction
if !exists(":Bdelete")
command -bang -bar Bdelete call <SID>Bdelete(<q-bang>)
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.