Creating PHP function list file
Since new functions could be added to PHP, or old function parameters changed, you may want to create your own function reference list to use with omni-completion in Vim.
- download the multi html documentation file from php.net
- unarchive the file
- inside the html folder, run this:
for i in `ls -1| grep "^function\."`; do grep -A4 Description $i >> funcs; done
- open the 'funcs' file in vim
- run
:g/Description/normal! 5J
- to remove html tags, run
:%s/<[^>]*>//g
- remove the 'Description' and leading spaces, run
:%s/^\s*Description\s*//g
- to create the dictionary, run
:%s/^\([^[:space:]]\+\) \([^[:space:]]\+\) ( \(.*\)/\\ '\2(': '\3) returns \1',/g
- remove all non-dictionary lines, run
:%s/^[^\\]*\n//g
- add the other necessary items, such as removing dollar signs and correct the ending parenthesis issue on some lines; then show how to finish the file and what to name it and where to put it; I'm doing the following in a new window and then executing it on the func file
:g/Description/normal! 5J :%s/<[^>]*>//g :%s/^\s*Description\s*//g :%s/^\([^[:space:]]\+\) \([^[:space:]]\+\) (\(.*\)/\\ '\2(': '\3) returns \1',/g :%s/^[^\\]*//g :%s/^\n//g :%s/))/)/g :%s/' /'/g :sort :sort u (we still need to fix a few bugs and clean up & and " values, maybe fixing open ['s too) it looks like the file should be called php.vim, and placed in ~/.vim/after/ftplugin/