romgrk / barbar.nvim

The neovim tabline plugin.
2.16k stars 81 forks source link

fix(events.lua): Listen for default and user-configured sidebar_filetype close events #503

Closed 03juan closed 1 year ago

03juan commented 1 year ago

Creates default BufWinLeave autocmd and appends custom option.event if it differs from the default.

Fails silently using pcall if the other event already deleted the autocmd from line 192.

Closes #502

Tested with "print debugs"

local ok, _ = pcall(del_autocmd, autocmd)
if not ok then
  print("couldn't delete autocmd", vim.inspect(autocmd), vim.inspect(e))
else
  print("deleted autocmd", vim.inspect(autocmd), vim.inspect(e))
end
03juan commented 1 year ago

The close events are cleared correctly both when toggling and quitting:

03juan commented 1 year ago

Possibly needs documentation changes to README?

03juan commented 1 year ago

I agree about the documentation, this is an implementation detail.

Iron-E commented 1 year ago

Thanks for the contribution!