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.

  1. download the multi html documentation file from php.net
  2. unarchive the file
  3. inside the html folder, run this:
    for i in `ls -1| grep "^function\."`; do grep -A4 Description $i >> funcs; done
  4. open the 'funcs' file in vim
  5. run
    :g/Description/normal! 5J
  6. to remove html tags, run
    :%s/<[^>]*>//g
  7. remove the 'Description' and leading spaces, run
    :%s/^\s*Description\s*//g
  8. to create the dictionary, run
    :%s/^\([^[:space:]]\+\) \([^[:space:]]\+\) ( \(.*\)/\\ '\2(': '\3) returns \1',/g
  9. remove all non-dictionary lines, run
    :%s/^[^\\]*\n//g
  10. FIXME 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 &amp; and &quot; values, maybe fixing open ['s too)
    
    it looks like the file should be called php.vim, and placed in ~/.vim/after/ftplugin/