On 11/8/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Nikolai Weibull wrote:
> Is <abuf> always guaranteed to be the same as <afile> and is <afile>
> always guaranteed to be unique?
>
> nikolai
>
1. No. From ":help <afile>":
<afile> when executing autocommands, is replaced with the file name
for a file read or write
<abuf> when executing autocommands, is replaced with the currently
effective buffer number (for ":r file" and ":so file" it is
the current buffer, the file being read/sourced is not in a
buffer).
IOW, for :read and :source, <abuf> is the current buffer and <afile> is not.
Ah, sorry. My question was incomplete. Is <abuf> guaranteed to be
equal to <afile> for all commands where a file isn't being
read/sourced? Specifically, do they refer to the same buffer for
BufDelete? The BufDelete documentation suggests using <afile>, but
I'd much prefer using the buffer number.
2. What do you mean, unique? A file can be opened in several windows, but the
buffer will normally be the same (I'm not sure about the case when a file is
opened by different names, owing to soft -- or, worse, hard -- links).
Forget it. Turns out that <afile> expands to the full path, so yes,
it's unique. The BufDelete documentation confused me because it
sounds like it's talking about the buffer name, not the buffer's
file's path.
Thanks.
nikolai