ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
791 stars 72 forks source link

use <abuf> to identify buffer during events #40

Closed deathlyfrantic closed 6 years ago

deathlyfrantic commented 6 years ago

This should fix #39 - lclose can sometimes cause the tabline to disappear even when there are multiple buffers remaining. Essentially the problem is buftabline always assumes the buffer being deleted is the current buffer, which is generally true, but not always true.

bufnr('%') gives us the number of the current buffer which is not necessarily the buffer that is being added or deleted. expand('<abuf>') gives us the number of buffer on which the event is operating, but as a string - so we need to convert it to a number with str2nr. We can then determine if the actual buffer being deleted is a user buffer or not.

I unintentionally committed some changes deleting some trailing whitespace - let me know if you want me to revert those lines.

ap commented 6 years ago

Yeah I don’t want the debris in there and I want the commit message a little less verbose, plus the comment needs tweaking now. But it’s quicker if I just amend the commit myself. Coming up.

ap commented 6 years ago

Applied as e662ccd6ed0b056989a56477a79370ea2aedc37d. Thank you for the patch. 😊