How to load the vim plugin manually?

754 views
Skip to first unread message

李哲

unread,
Apr 14, 2016, 4:45:06 AM4/14/16
to vim_use
Raise my question first: how to load a vim script manually? for example I can run a vim script by command line.

I use the vim plugin named AutoComplPop(which vim file named acp.vim). It load automatic at the start of the vim.

I found a acp.vim in the autoload folder, and I delete it. But a error popup `Unknown function: acp#enable`. So I could not delete it.

I search for the topic `vim autoload management` and `vim prevent autoload script`
but I can't get the answer I want.

So I come here for help.

Ben Fritz

unread,
Apr 14, 2016, 11:17:24 AM4/14/16
to vim_use
Autoload may be a bit confusing. It means, "don't source this file right away, only load it when you try to use it."

There is probably a file in a "plugin" or "ftplugin" or both which use functions from the autoload file you were trying to remove.

One way to do this (in older Vims) would be to put the plugin file somewhere else. Leave the autoload file where it is. Then to load the plugin you would ":source path/to/the/file.vim".

Another way is to use a package manager supporting a "load plugins on demand" feature.

In the latest Vim and the upcoming 8.0 release, it gets easier. Your entire plugin can go into ~/.vim/pack/whatever/opt/plugin_name and related folders (autoload, plugin, etc.)

Then to load your plugin you just do :packadd plugin_name.

汪伟斌

unread,
Apr 15, 2016, 4:15:30 AM4/15/16
to vim...@googlegroups.com
In my opinion, there may be some file than have dependency on this file acp.vim,
u may grep -r -e "acp" path/to/vim/plugin.
Hope that this may help u.
:D


 

Christian Brabandt

unread,
Apr 15, 2016, 4:21:40 AM4/15/16
to vim...@googlegroups.com
Hi 汪伟斌!
> In my opinion, there may be some file than have dependency on this file acp.vim, u may grep -r -e "acp" path/to/vim/plugin.Hope that this may help u.:D

You shouldn't just delete the file from the autoload folder. It is
probably being called from the plugin/acp.vim file.

However, if you really want to load the file manually, it should be
sufficient to let vim source the plugin file and then Vim usually finds
the autoload file itself and loads it if needed.

Best,
Christian
--
Wenn es Ende November schneit ist der Dezember nicht mehr weit.
Reply all
Reply to author
Forward
0 new messages