Test *<afile>* and *bufname("%")* with this command:
autocmd BufUnload * echomsg "[BufUnload] <afile>: " . expand('<afile>') . "
- bufname('%'): " . bufname('%')Cases and results: 1. :quit <afile> is the original buffer, buffer "%" is the newly focused buffer. 2. :edit! <afile> is the same as buffer "%", the original buffer. 3. gf <afile> is the same as buffer "%", the original buffer. I think in "gf" case, buffer "%" should be the newly loaded one, which makes sense since it's identical with the :quit case. How do you feel about this, can we change it? Reference: descriptions for <afile> - :help <afile> When executing autocommands, is replaced with the file name for a file read or write. - :help BufUnload the current buffer "%" may be different from the buffer being unloaded "<afile>". -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
