Integrate PHP manual into (g) Vim

Source: Internet
Author: User
Tags gz file

  • Author: laruence ()
  • Address: http://www.laruence.com/2010/08/18/1718.html
  • Reprinted please indicate the source

Let's talk about it first. Vim has released 7.3 ..

When looking at the vim plug-in, I found an interesting application (not a plug-in): to integrate the PHP manual into vim, in Vim, press "K ", you can jump to the manual instructions of the function under the cursor...

1. First download the specially customized PHP Manual (including all the functions of php5.3): vim-php-manual.tar.gz

2. decompress the downloaded file and place it in a directory, such as/tmp/phpmuanul (for example, "d:/phpmanual" in Windows ").

3. Configure vimrc (. vimrc in Linux and _ vimrc in Windows) and add the phpmanual directory to runtimepath (to explain why ).

4. Configure vimrc so that keywordprg = "help". On my machine, the default keywordprg is! Man, most of the time, I still want to directly connect man to the standard function library in Linux, so I use (in the vimrc file ):

<Ol style = "margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: Inherit; font-size: 12px; font-family: Inherit; vertical-align: baseline; List-style-type: none; "> <li style =" margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-Right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: Inherit; Vertical-align: baseline; "> autocmd bufnewfile, bufread *. ros ,*. INC ,*. PHP set keywordprg = "help" </LI> </OL> <p>

Alternatively, you can write the php. Vim file in the ftplugin directory of VIM (if it is not created). When ft is Php, the configuration script will be loaded.

The reason why I want to add the phpmanual directory to runtimepath is:

<Ol style = "margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: Inherit; font-size: 12px; font-family: Inherit; vertical-align: baseline; List-style-type: none; "> <li style =" margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-Right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: Inherit; Vertical-align: baseline; "> when no argument is given: help the file given with the 'helpfile' option </LI> <li style = "margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-Right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: Inherit; Vertical-align: baseline; "> will be opened. otherwise the specified tag is searched for in all "DOC/tags" </LI> <li style = "margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-Right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: Inherit; Vertical-align: baseline; "> files in the Directories specified in the 'runtimepath' option. </LI> </OL> <p>

In vim, when you call help, help searches for the tags file in the doc directory of all runtimpath to find the help keyword.

The downloaded vim-php-manual.tar.gz file contains the file directory structure such as DOC/tags. Therefore, you only need to add the phpmanual directory to runtimepath and set keywordprg as the help of vim, you can jump to the function manual by pressing "K" at the cursor.

Use

at last, add, vim prompts you:

<Ol style = "margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: Inherit; font-size: 12px; font-family: Inherit; vertical-align: baseline; List-style-type: none; "> <li style =" margin-top: 0px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-Right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: Inherit; Vertical-align: baseline; "> tags file not sorted </LI> </OL> <p>

Use Vim to open phpmanual/doc/tags, then % sort will work...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.