Event: BufLeave

The BufLeave event:

Fires:

Before leaving to another buffer.

When leaving or closing the current window and the new current window does not contain the same buffer.

Notes:

Does not fire when exiting Neovim with :qa or :q.