суббота, 29 сентября 2012 г., 0:03:23 UTC+4 пользователь ZyX написал:
> > It is not triggered when current and unloaded buffers are different, but
> > when it triggers, current buffer and buffer being unloaded might be
> > different. That is bufnr('%') can be different then "<afile>".
>
> Is not that what I said?
No it is not. But you are wrong:
vim -u NONE -c 'autocmd BufUnload * echom expand("<abuf>") bufnr("%")' \
-c 'vnew' \
-c 'echom bufnr("%")' \
-c 'bw! 1'
. You will see
2
1 2
. Obviously, that means that current and unloaded buffers are different. You
may replace first "echom" with "setlocal" and see that option is set for a
wrong buffer. Your autocmd must not be used.
By the way, "bufnr('%')" is almost always different from <<"<afile>">>. First
is buffer number, second is a plain string. Or a filename if you meant
"expand("<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