sponsor Vim development Vim logo Vim Book Ad

Asneeded 2 : Load scripts as needed

 script karma  Rating -1/1, Downloaded by 1021  Comments, bugs, improvements  Vim wiki

created by
Andy Wokula
 
script type
utility
 
description
Asneeded allows loading a script by the name of a command or function that
the script defines.  You can use :AN to load by a command; functions are
loaded automatically (via FuncUndefined).

Example (this is supposed to work with the default setup):

:AN ANedit

This will source the script  AsNeeded/anplus.vim  (located below the
'runtimepath') which defines the :ANedit command.

Before :AN can be used, user scripts need to be scanned with :ANmakeTags to
create ANtags files.  These files (like normal tags files) map commands and
functions to script file names.  In order to find ANtags files,
g:asneeded_path needs to be set up properly.

This script has the same purpose as the AsNeeded plugin created by DrChip
(vimscript #915).

The ANtags file format is compatible, but paths included in file names are
not recognized.  In other words, each directory needs its own ANtags file.


Comparison (not to be taken too seriously...) of both scripts:

Advantages:
- no creation of temporary buffers
- configurable load path (load scripts from more than one location)
- command-line completion instead of a menu
- :ANmakeTags creates tags for certain files, not for a whole directory
- :AN only loads a script if the command argument is not defined yet
- single tags can be disabled in the ANtags file to solve ambiguities

Left Offs:
- mappings are not recognized (at least not per default)
- no "on-the-fly" mode: search for functions and commands requires an ANtags
  file
- :AN only takes a command name as argument (not a function name)
- no creation of skeleton commands (beyond purpose)

DrChip's AsNeeded version: 17c
 
install details
Notes:
- Asneeded comes in a ZIP-archive, easy to inspect with your file manager.
- There is a new folder "AsNeeded".

You can now unpack (to ~\vimfiles or ~/.vim ...) and do :helptags

Yet to be tested on Unix.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
asneeded_0.1.1.zip 0.1.1 2009-10-20 7.0 Andy Wokula BF: didn't ignore entries with paths in ANtags files
asneeded.zip 0.1 2009-10-19 7.0 Andy Wokula Initial upload
ip used for rating: 54.81.157.133

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github