Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim helptag generation

Tags:

vim

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?

Thanks!

like image 587
So8res Avatar asked Nov 15 '10 00:11

So8res


People also ask

What are help tags?

Tags help you organize and categorize the messages in HelpDesk. Tags are labels attached to the tickets that help you identify the contents of a message.

How do I create tags in Vim?

The more you know about the code, the more you understand the project. The way tag system works in Vim, is that Vim relies on a tag generator to generate a tag file (normally called tags in root directory) that contains a list of definitions. To see where Vim expects to find a tags file, you can run :set tags?.

What are Vim helptags and how do they work?

Part of the job performed by virtually all plugin managers in Vim is to create helptags, which will index the help files shipped with the plugins and will allow searching for commands and mappings added by the plugins themselves.

What is Vivi and Vim Stack Exchange?

Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up. Sign up to join this community

How to add helptags to the Helpfile?

1. :set helpfile to a file help.txt in a directory of your choice. The file can be empty. 2. :set runtimepath+=<directory of new helpfile> Then the helptags of all *.txt files in the new directory are additional available.


2 Answers

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.

like image 76
Chris Johnsen Avatar answered Oct 11 '22 13:10

Chris Johnsen


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.

like image 44
Cascabel Avatar answered Oct 11 '22 14:10

Cascabel