On Wed, Oct 14, 2015 at 10:15 AM, Peng Dai <[email protected]> wrote:
> I used vundle.vim to manage my plugin now. And I write my own conf in the 
> vimrc.
>
> I now want to write all my own-conf tobe a vim-plugin, which will be hosted 
> on the github and be installed by Vundle.vim.
>
> I have to do somethings before all others plugins loading, for example set 
> other plugins options.
> I also need to do somethings after all others plugin loaded. for example my 
> own keymapping, :set cmd.
>
> I cant set my plugin at the last of runtimepath, and put my keymap-config in 
> the after directory.
> But I really do not know how to do things before other plugins. cause there 
> is no before directory at all.
>
> So I am here for some help. thanks.


The runtime directories are searched in the sequence in which they are
listed in 'runtimepath' which I STRONGLY recommend to leave at the
following default value:
1. ~/.vim (Unix) or ~/vimfiles (Windows) for user-private scripts
2. $VIM/vimfiles for scripts common to all users of a given system,
but not distributed with Vim
3. $VIMRUNTIME for scripts distributed with Vim, which are part of the
standard Vim installation
4. $VIM/vimfiles/after for system-wide scripts requiring late-loading
5. ~/.vim/after or ~/vimfiles/after for user-private scripts requiring
late-loading.

Those other than #3 above don't always exist; that is not an error.
For instance, near the end of startup Vim sources all *.vim scripts in
the plugin/ subdirectory of each of the above in turn, skipping
anything that doesn't exist.

So you see, 1 and 2 above are the "before" directories, in that they
are loaded before $VIMRUNTIME; while 4 and 5 are (in the opposite
order) the "after" directories. If you want to divide a global plugin
(i.e. a plugin sourced once at startup) into "before" and "after"
parts, you could drop the "before" part in ~/.vim/plugin (on Unix) or
~/vimfiles/plugin (on Windows) and the "after" part in
~/.vim/after/plugin or ~/vimfiles/after/plugin.

Alternately, you could also include the "before" part in your vimrc
(which is sourced at the begin of startup, before any plugins), or
source it from there, and source the "after" part from an autocommand
for the VimEnter autocommand (which is triggered at the very end of
startup). In this case you might drop them both (with different names,
of course) in some directory where Vim doesn't look spontaneously,
such as for instance (on Unix) ~/.vim/scripts/

See
    :h startup
    :h gui-start
    :h 'runtimepath'
    :h :source
    :h :runtime


Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui