On 8/27/06, 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.

If autocommand that reads in the text of the skeleton is you own
code and you can modify it, then you can add add :doautocmd in
the autocommand (I guess you'll need 'nexted' option then, too)

   :help :doautocmd
   :help autocmd-nested

Yakov

Reply via email to