pokey
pokey

Reputation: 108

Extraneous BufUnload event triggered in vim

I run vim with no file on the command-line, so that it shows the scratch buffer. When I then run

:e foo

to edit file 'foo', there is a BufUnload event triggered for file 'foo'. Here is a test vim command that I use to demonstrate the issue:

autocmd BufUnload * echom "Unloaded " . expand("<afile>")

Does anyone know what is causing this, and if there is a way to detect this situation and ignore it?

Upvotes: 1

Views: 170

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172698

I can reproduce this with the latest Vim 7.4a.39. I guess this has to do with the fact that Vim reuses the initial scratch buffer number (1) for the first :edited file. Please report this problem to the vim_dev mailing list.

Upvotes: 1

Related Questions