Bill McCarthy wrote:
Hello Vim List,
I just tried out Chip's AsNeeded script. After installing
the VBA, I copied everything from \vim\vimfiles\plugin\
(except scripts, like netrwPlugin, which also exist in
$vimruntime\plugin) to \vim\vimfiles\AsNeeded\.
I then tried it out on one of the same author's scripts:
:AlignCtrl mp0P0
to which Gvim responds:
E492: Not an editor command: AlignCtrl mp0P0
I know I'm missing something obvious here. Anyone know
what?
AsNeeded uses the FuncUndefined autocommand to transparently load functions.
Commands and maps, unfortunately, are not blessed with such an autocommand.
Hence AsNeeded provides:
:AN map-or-command
:ANX map-or-command
The :AN loads only; ANX also attempts to execute. In addition, one may use
:MkAsNeeded
to create a plugin/ANcmds.vim file which provides a number of commands-only
which load and execute the requested command.
Once loaded, commands and maps no longer need AsNeeded-style intervention.
Regards,
Chip Campbell