Loading ...
Sorry, an error occurred while loading the content.

26103Re: script bloat

Expand Messages
  • Benoit Cerrina
    Nov 2, 2001
    • 0 Attachment
      Problem with one pottentially large standard library is that you load
      it all or not at all. This is why I was suggesting a directory with
      plenty of smaller vim files containing each one library function, those
      would autoload thanks to the

      " autoload stuff
      fu! LoadOnDemand(funcname) abort
      " first, save our current location information:
      " see if the function exists:
      let fn = $VIMGLOBAL.'/auto/'.a:funcname.'.vim'

      if filereadable(fn)
      exe 'source ' . fn
      endif
      endfunc

      aug autoload_package
      au FuncUndefined * :call LoadOnDemand(expand("<afile>"))
      aug END

      script which would be sourced early (this has to be one of the first plugins
      sourced)
      Benoit

      ----- Original Message -----
      From: "Brian Medley" <bpmedley@...>
      To: "Benji Fisher" <benji@...>
      Cc: <vim-dev@...>
      Sent: Friday, November 02, 2001 3:55 AM
      Subject: Re: script bloat


      > On Thu, Nov 01, 2001 at 09:08:34PM -0500, Benji Fisher wrote:
      >
      > > I notice that the standard explorer.vim plugin implements a sort routine
      > > as a vim script. (I think this was taken from the vim help files, where
      > > credit is given to Robert Webb.) That would be convenient to use in my
      > > own scripts, but I do not know a convenient way to access it, since it
      is
      > > a script-local function. I could just copy it into my own script, but
      it
      > > is rather long.
      > >
      > > To reduce total script size and improve maintainability, is there some
      > > way we could re-use code in vim scripts? Perhaps a standard plugin with
      > > a reserved <SNR> could contain a library of vim functions?
      >
      > I think this would be a great idea. I vim library would be ideal.
      >
      > --
      > ~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-., \|/ (___) \|/ _,.-=~'`^`
      > Brian Medley @~./'O o`\.~@
      > "Knowledge is Power" brian.medley@... /__( \___/ )__\ *PPPFFBT!*
      > -- Francis Bacon `\__`U_/'
      > _,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~= <____|' ^^`'~=-.,__,.-=
      > ~`'^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-==--^'~=-.,__,.-=~'`^`
      >
    • Show all 24 messages in this topic