I use pathogen and have an update script that downloads the latest versions of all the vim plugins I use from vim.org, github, or wherever else they may be. However, this script does not currently update the vim helptags. In order to do so, I have to go to each updated plugin in vim and execute ":helptags doc/". It would be great if I could do so with my update script, but in order to do so I need to run the vim ":helptags" command from a script. Is this possible?
Tha开发者_如何学Gonks!
pathogen.vim versions after 1.2 (2010-01-17) have a pathogen#helptags
function that will automatically update the help tags for each directory in the runtimepath
. Just call it after you call pathogen#runtime_append_all_bundles
:
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
Or, assuming you have call pathogen#runtime_append_all_bundles()
in your .vimrc
:
vim -c 'call pathogen#helptags()|q'
from the command line only once after you have fetched the updates.
Recent versions of pathogen recommend calling pathogen#infect()
in your .vimrc
instead of pathogen#runtime_append_all_bundles
(since b147125 “Add pathogen#infect() as primary entry point for basic setup”, 2011-05-13; the former calls the latter internally). If your .vimrc
is calling pathogen#infect()
, then put your call to pathogen#helptags()
after that.
Shouldn't all of the documentation be in the same doc
directory? Maybe .vim/doc, /usr/share/vim/vimfiles/doc?
In any case, you can launch vim, and direct it to run a command:
cd <plugindir>
vim -c "helptags doc/"
You can specify multiple commands, so the last one can be -c q
to have vim exit when you're done. (Or you can tack it on as one command, command1 | q
.) Or, if you have many commands to run, you can generate a script, and have vim run it using vim -S <script>
; again, you can make the last command of the script q
so it closes when it's done.
In recent enough versions, :helptags ALL
will work.
For some time pathogen provides the Helptags
command that updates the documentation of all your bundles (and all other directories that are part of the runtimepath
).
Thus, it's sufficient to call
:Helptags
after your Vim plugin collection has changed. Possibly even automatically by calling e.g. vim -c Helptags -c q
from your update script.
精彩评论