On 22/03/09 23:57, Edward Beach wrote:
>
> Hello,
>
> I have an extremely long vimrc file that I would like to organize by
> splitting up into blocks of vim scripts; the easiest step seems to
> first put all of my vim maps and functions into my own script library.
>
> Now there seems to be many ways that I can go about doing this, namely
> runtime, source, or autoload, so which one is more appropriate in my
> case?
>
> Thanks!
> Edward

All three can be used, or any mixture of the three, depending on your 
exact needs.

The autoload mechanism is for on-demand loading of functions which might 
not be needed at all in a particular session.

The ":source" command is for single scripts with well-defined locations, 
however it is longer to type than ":runtime" when the script is in one 
of the 'runtimepath' trees.

The ":runtime" command allows searching at a given relative location in 
all 'runtimepath' trees until the appropriate script is found, or, with 
an exclamation mark, loading all scripts of the same name at the same 
relative location. It is also more economical of keystrokes if the 
script to be sourced is in one of the 'runtimepath' trees: for instance

        runtime vimrc_example.vim
        runtime delmenu.vim

etc., are shorter than the equivalentrather

        source $VIMRUNTIME/vimrc_example.vim
        source $VIMRUNTIME/delmenu.vim

etc.

In addition, you can have user plugins, e.g. global plugins at 
~/.vim/plugin/*.vim (under Unix) or ~/vimfiles/plugin/*.vim (under 
Windows), for self-contained scripts which you want to run at every 
startup, near the end of startup (unlike the vimrc which is sourced near 
the begin of startup). If you want one particular global plugin of yours 
to run after the standard ones, you can even place it in 
~/{.vim|vimfiles}/after/plugin/.


Best regards,
Tony.
-- 
"We are upping our standards ... so up yours."
                -- Pat Paulsen for President, 1988.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to