Home php教程 php手册 将PHP Manual融入(g)Vim

将PHP Manual融入(g)Vim

Jun 21, 2016 am 08:52 AM
vim

  首先说个题外话: Vim发布7.3了..

  在翻看Vim插件的时候, 发现了一个比较有意思的应用(非插件): 把PHP的手册融如Vim中, 在Vim中, 按”K”, 就可以跳转到光标下函数的手册说明…

  1. 首先, 下载特殊定制的PHP手册(包含PHP5.3的所有函数) : vim-php-manual.tar.gz

  2. 把下载的文件解压缩, 放置到一个目录, 比如/tmp/phpmuanul(windows下比如:”d:/phpmanual”).

  3. 配置vimrc(linux下是.vimrc,windows下是_vimrc), 把phpmanual目录添加到runtimepath(稍后解释为什么).

  4. 配置vimrc, 使得keywordprg=”help”. 在我的机器上, keywordprg默认是!man, 大多数时候, 我还是希望可以直接man到linux下的标准函数库, 所以我使用(在vimrc文件中):

  autocmd BufNewFile,Bufread *.ros,*.inc,*.php set keywordprg="help"

  或者也可以写在vim目录下的ftplugin下的php.vim(如果没有新建), 这样在ft为php的时候,这个配置脚本就会被加载.

  至于说, 为什么要把phpmanual目录添加到runtimepath, 是因为:

  When no argument is given to :help the file given with the 'helpfile' optionwill be opened. Otherwise the specified tag is searched for in all "doc/tags"files in the directories specified in the 'runtimepath' option.

  意思就是说, 在vim中, 调用help的时候, help会去所有的runtimpath下的doc目录中寻找tags文件, 来寻找要查找的帮助关键字.

  在我们下载的vim-php-manual.tar.gz文件中, 就包含了doc/tags这样的文件目录结构, 所以只要把phpmanual目录加入runtimepath, 并且设置keywordprg为vim的help, 就可以实现在光标处按”K”跳转到函数手册了.

  

 

  使用截图

  最后,补充一点, 如果在使用的时候,Vim提示你:

  tags file not sorted

  那你就用vim打开phpmanual/doc/tags, 然后%sort一下就可以了…



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to add the Escape key to your iPad keyboard How to add the Escape key to your iPad keyboard Apr 16, 2023 pm 01:43 PM

How to Remap CapsLock to ESC on iPad Keyboard Are you ready to make CapsLock the ESC key on your iPad? Here's all you need to do: Open the Settings app on your iPad Go to "General" then go to "Keyboard" Go to "Hardware Keyboard" Select "Modifier Keys" Select "CapsLockKey" and select "Escape" as Modifier Keys Now you're ready to try out the new hardware ESC key on your iPad by pressing CapsLock. Go to any application that uses the Escape key and you can test it immediately, such as vi/vim. Now you can use a physical keyboard from

How to use Vim to delete even or odd lines in Linux How to use Vim to delete even or odd lines in Linux May 22, 2023 pm 05:07 PM

The method of deleting even-numbered lines is as follows: :g/^/+1d The :gbobal command is used above. The gbobal command format is as follows: :[range]global/{pattern}/{command}global command is actually divided into two steps: first Scan all the lines within the range specified by [range] and mark the lines matching {pattern}; then execute the {command} command on the marked lines in sequence. If the marked lines are marked during the command operation on the previous matching lines, If you delete, move or merge, the mark will automatically disappear without executing the {command} command on the line. {command} can be an ex command or separated by |

A brief analysis of 3 methods to install Vim on Alpine Linux A brief analysis of 3 methods to install Vim on Alpine Linux Mar 24, 2023 pm 02:28 PM

In PHP development, using Vim is very common. However, you may encounter some problems installing Vim in Alpine Linux. This article will share how to install Vim on Alpine Linux.

How to save and exit vim How to save and exit vim Aug 01, 2023 am 10:47 AM

How to save and exit vim: 1. Use shortcut keys to save and exit; 2. Use a separate command to save and exit; 3. Use automatic commands to save and exit; 4. Use shortcut keys to save the file.

Linux Tips: Cancel automatic indentation when pasting in vim Linux Tips: Cancel automatic indentation when pasting in vim Mar 07, 2024 am 08:30 AM

Preface: vim is a powerful text editing tool, which is very popular on Linux. Recently, I encountered a strange problem when using vim on another server: when I copied and pasted a locally written script into a blank file on the server, automatic indentation occurred. To use a simple example, the script I wrote locally is as follows: aaabbbcccddd. When I copy the above content and paste it into a blank file on the server, what I get is: aabbbcccddd. Obviously, this is what vim does automatically for us. Format indentation. However, this automatic is a bit unintelligent. Record the solution here. Solution: Set the .vimrc configuration file in our home directory, new

Learn all aspects of Vim split-screen operation in 5 minutes Learn all aspects of Vim split-screen operation in 5 minutes Aug 03, 2023 pm 03:20 PM

Vim's split-screen function is implemented by splitting windows, which is a great tool for improving work efficiency. Whether we want to display two files at the same time, or display two different locations of a file at the same time, or compare two files side by side, etc., these can be achieved through split screen, which is very convenient for code comparison and copy and paste.

Install smbclient on CentOS and install vim on CentOS Install smbclient on CentOS and install vim on CentOS Feb 13, 2024 pm 04:30 PM

In the CentOS operating system, smbclient and vim are two very commonly used tools. smbclient is a client tool used to communicate with SMB/CIFS servers, and vim is a powerful text editor. This article will introduce in detail how to Install smbclient and vim on CentOS and provide some related usage tips. 1. Open a terminal and log in as root user. 2. Run the following command to update the system package list: ```yumupdate3. Run the following command to install smbclient: yuminstallsmbclient4. The system will prompt you to confirm the installation, press the y key and press the Enter key to

Detailed introduction to the encryption and decryption methods of Vim text in CentOS Detailed introduction to the encryption and decryption methods of Vim text in CentOS Dec 31, 2023 pm 02:49 PM

CentOS uses vim/vi to encrypt and decrypt files 1. Use vim/vi to encrypt: Advantages: After encryption, if you don’t know the password, you cannot see the plain text, including root users; Disadvantages: It is obvious that others know the encryption , it is easy for others to destroy encrypted files, including content destruction and deletion; I believe everyone is familiar with the vi editor. There is a command in vi to encrypt files. For example: 1) First, in the root master Create an experimental file text.txt under the directory /root/: [root@www~]#vim/vitext.txt2) Enter the editing mode, press ESC after entering the content, and then enter: X (note the capital X), Enter; 3)

See all articles