Skip to content

Commit

Permalink
Use buflisted() to check before deleting a buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
moll committed Mar 3, 2018
1 parent 9e7e6c0 commit b37d820
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased
- Adds `:Bwipeout`. Thanks, [Juan Ibiapina](http://juanibiapina.com/)!
- Adds `:Bwipeout`. Thanks, [Juan Ibiapina](http://juanibiapina.com)!
- Fixes `:Bdelete`ing an already unlisted buffer.
That happens when you close a buffer that itself closes when switched away from.
Thanks, [Samuel Simões](http://blog.samuelsimoes.com), for debugging help!

## 1.0.1 (Jul 23, 2013)
- Fixes `:Bdelete`ing via buffer number. Finally, perfect!
Expand Down
5 changes: 4 additions & 1 deletion plugin/bbye.vim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function! s:bdelete(action, bang, buffer_name)

" If it hasn't been already deleted by &bufhidden, end its pains now.
" Unless it previously was an unnamed buffer and :enew returned it again.
if bufexists(buffer) && buffer != bufnr("%")
"
" Using buflisted() over bufexists() because bufhidden=delete causes the
" buffer to still _exist_ even though it won't be :bdelete-able.
if buflisted(buffer) && buffer != bufnr("%")
exe a:action . a:bang . " " . buffer
endif
endfunction
Expand Down

0 comments on commit b37d820

Please sign in to comment.