I'd like to before :sourc'ing a file to execute
one of my scripts (always the same).

I though the autocmd 'SourcePre' event will
help nut I can't get it work the way I'd needed it:

As a first test I did:
:au SourcePre *.vim let g:sfile=<afile> 
        then <amatch> (I know <sfile> will not
      work before it gets expanded too early)

If I now do :source test.vim
which contains just 'echo g:sfile'
I get errors about invalid expression <afile>
or <amatch> depending what I used for :au.

The idea was to get the file name in g:sfile of the
file which is about to be sourced so I can call my
function (in that autocmd) to process the file
before it's :sourced.
How can this be done?

I also thought 'runtime' is somehow equivalent
to :source, except it is smart enough
to use 'runtimepath'. Using the same test above
(':runtime test.vim') I found this does *not*
fire up the autocmd while :source does.

Is this intentional or can it be considered a bug?

---Zdenek

----------------------------------------
Zdenek Sekera              | [EMAIL PROTECTED] 
LHC Computing Grid Project | mobile: +41-76-487.4971
CERN - IT Division         | tel:    +41-22-767.1068

Reply via email to