It's a buflocal autocmd (:help autocmd-buflocal). It doesn't require a
file pattern.
>From the help file:
Instead of a pattern buffer-local autocommands use one of these forms:
<buffer> current buffer
<buffer=99> buffer number 99
<buffer=abuf> using <abuf> (only when executing autocommands)
|<abuf>|
This is what I'm doing. There are several examples in the help file
almost exactly like what I'm doing.
On Dec 5, 6:24 pm, Ben Schmidt <[EMAIL PROTECTED]> wrote:
> Ian wrote:
> > On Dec 5, 4:46 pm, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> >> Ian Taylor wrote:
> >>> There seems to be some strange behavior when using the buftype=acwrite
> >>> mode.
> >>> mkdir testdir
> >>> vim
> >>> :set buftype=acwrite
> >>> :autocmd BufWriteCmd <buffer> echo 'requested write'
> >> The file pattern is missing.
>
> >>> :file testdir
> >>> :w
> >>> This causes an error that 'testdir' already exists.
> >>> It works when I do
> >>> :w!
> >>> but, that doesn't seem like it should be necessary.
> >>> This seems like incorrect behavior since buftype=acwrite means that
> >>> writes really take place by the autocmd. In my case, this involves
> >>> network traffic and I don't care about the local filesystem at all.
> >> You must make sure yourself that the BufWriteCmd autocommand takes care
> >> of the writing. See ":help E767".
>
> > Well, in my example, the autocommand doesn't seem to be processed if
> > the directory already exists (named the same thing as the buffer).
> > That's the issue.
>
> > Everything works as expected with my autocommand if there doesn't
> > happen to be a local directory named the same as the buffer. It
> > doesn't seem to me that it should matter what is in my current
> > directory if I set the buftype to acwrite or nofile.
>
> Are you sure? Did you see Bram's earlier comment that the file pattern is
> missing
> from your autocommand? Worth checking.
>
> Ben.
>
> Send instant messages to your online friendshttp://au.messenger.yahoo.com
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---