> -----Original Message----- > From: Eric Arnold [mailto:[EMAIL PROTECTED] > Sent: 26 May 2006 16:07 > To: Zdenek Sekera > Cc: vim-dev@vim.org > Subject: Re: source, runtime and all that > > On 5/26/06, Eric Arnold <[EMAIL PROTECTED]> wrote: > > Try expanding it. > > > > au SourcePre *.vim echomsg "afile=" . expand("<afile>") > > au SourcePre *.vim let @a = <afile> > > > au SourcePre *.vim let @a = expand("<afile>" ) >
That works nicely. Thanks! Any idea about that runtime problem? ---Zdenek > > > On 5/26/06, Zdenek Sekera <[EMAIL PROTECTED]> wrote: > > > 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 > > > > > >