Hi,

Bill McCarthy wrote:
> 
> Suppose two plugins define autocmds, so after start Vim,
> 
>     :au FuncUndefined
> 
> displays:
> 
>     *         call AsNeeded(1,expand("<afile>"))
>     Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
> 
> Now I add a line to my _vimrc:
> 
>     au! FuncUndefined * call Foo()
> 
> Now after starting Vim and typing :au FuncUndefined
> 
>     *         call Foo()
>               call AsNeeded(1,expand("<afile>"))
>     Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
> 
> It did not replace!

it can't replace. Your _vimrc is sourced before all plugins, so at the
time your autocommand command is executed there's no other autocommand
to be replaced.

> Now removing the line I added to _vimrc, starting Vim and
> typing :au! FuncUndefined * call Foo()
> 
> I get what I expected from :au FuncUndefined
> 
>     Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
>     *         call Foo()
> 
> Vim only appears to fail in startup - it is not just a
> script error.  If I write a small script file that just
> contains the line:  au! FuncUndefined * call Foo()
> 
> Sourcing that script works just like typing the command.

Putting this script in the after\plugin directory of the local or
personal part of your runtime path (i.e., $VIM\vimfiles\after\plugin or
$HOME\vimfiles\after\plugin) is the best way to replace or delete an
existing autocommand.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

Reply via email to