Hello,
--- Elliot Shank <[EMAIL PROTECTED]> wrote:
> What I'm trying to do is create a plugin that acts based upon the contents of
> an arbitrary file buffer as soon after it has loaded its contents as
> possible.
>
> For existing files, using a BufReadPost autocmd is fine.
>
> For new file buffers that have text loaded into them via a BufNewFile
> autocmd, I can't just create a BufNewFile autocmd myself because I can't
> guarantee that mine will run last.
>
> So, the obvious thing to do is use BufEnter and/or BufWinEnter.
>
> However, I've got other plugins that will need the result of the new plugin
> and that want to use BufEnter and BufWinEnter themselves, which leads me back
> to the ordering problem. I can't make sure that the plugin will run first.
>
> It looks like FileType and Syntax events can occur between BufNewFile and
> BufWinEnter, but this only happens for files that a file type can be figured
> out for. If I edit a non-existent file called "blah", there aren't any
> events between BufNewFile and BufWinEnter.
>
>
> Any suggestions?
>
Hi Elliot,
Perhaps put your plugin in after/plugin/yourplugin.vim, because the :runtime
command used to load all the plugins looks in plugin/ before it looks in
after/plugin. If your plugin is loaded last, then hopefully it's autocommands
will also be the last BufNewFile commands to be executed. I can't remember
correctly, but there may be another event which runs every time your run a
vimscript using ':source' or 'runtime'. If that is the case, you could maybe
use that ~ScriptRun~ event to clear and redefine your BufNewFile autocommands
so that they are always added last after every other script of any kind, and
hopefully they will then always be the last BufNewFile commands.
I have no idea if any of that will work, all the best!
regards,
Peter
____________________________________________________
On Yahoo!7
Messenger - Make free PC-to-PC calls to your friends overseas.
http://au.messenger.yahoo.com