Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: php |
Bram Moolenaar | 1588bc8 | 2022-03-08 21:35:07 +0000 | [diff] [blame] | 3 | " |
| 4 | " This runtime file is looking for a new maintainer. |
| 5 | " |
| 6 | " Former maintainer: Dan Sharp |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 7 | " Last Changed: 20 Jan 2009 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
| 9 | if exists("b:did_ftplugin") | finish | endif |
| 10 | |
| 11 | " Make sure the continuation lines below do not cause problems in |
| 12 | " compatibility mode. |
Bram Moolenaar | 9a7224b | 2012-04-30 15:56:52 +0200 | [diff] [blame] | 13 | let s:keepcpo= &cpo |
| 14 | set cpo&vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 15 | |
| 16 | " Define some defaults in case the included ftplugins don't set them. |
| 17 | let s:undo_ftplugin = "" |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 18 | let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | \ "All Files (*.*)\t*.*\n" |
| 20 | let s:match_words = "" |
| 21 | |
| 22 | runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim |
| 23 | let b:did_ftplugin = 1 |
| 24 | |
| 25 | " Override our defaults if these were set by an included ftplugin. |
| 26 | if exists("b:undo_ftplugin") |
| 27 | let s:undo_ftplugin = b:undo_ftplugin |
| 28 | endif |
| 29 | if exists("b:browsefilter") |
| 30 | let s:browsefilter = b:browsefilter |
| 31 | endif |
| 32 | if exists("b:match_words") |
| 33 | let s:match_words = b:match_words |
| 34 | endif |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 35 | if exists("b:match_skip") |
| 36 | unlet b:match_skip |
| 37 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 38 | |
| 39 | " Change the :browse e filter to primarily show PHP-related files. |
| 40 | if has("gui_win32") |
| 41 | let b:browsefilter="PHP Files (*.php)\t*.php\n" . s:browsefilter |
| 42 | endif |
| 43 | |
| 44 | " ### |
| 45 | " Provided by Mikolaj Machowski <mikmach at wp dot pl> |
| 46 | setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\? |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 47 | " Disabled changing 'iskeyword', it breaks a command such as "*" |
| 48 | " setlocal iskeyword+=$ |
| 49 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 50 | if exists("loaded_matchit") |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 51 | let b:match_words = '<?php:?>,\<switch\>:\<endswitch\>,' . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | \ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' . |
| 53 | \ '\<while\>:\<endwhile\>,' . |
| 54 | \ '\<do\>:\<while\>,' . |
| 55 | \ '\<for\>:\<endfor\>,' . |
| 56 | \ '\<foreach\>:\<endforeach\>,' . |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 57 | \ '(:),[:],{:},' . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | \ s:match_words |
| 59 | endif |
| 60 | " ### |
| 61 | |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 62 | if exists('&omnifunc') |
| 63 | setlocal omnifunc=phpcomplete#CompletePHP |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 64 | endif |
| 65 | |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 66 | " Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com> |
| 67 | let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function' |
| 68 | let s:class = '\(abstract\s\+\|final\s\+\)*class' |
| 69 | let s:interface = 'interface' |
| 70 | let s:section = '\(.*\%#\)\@!\_^\s*\zs\('.s:function.'\|'.s:class.'\|'.s:interface.'\)' |
| 71 | exe 'nno <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>' |
| 72 | exe 'nno <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>' |
| 73 | exe 'ono <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>' |
| 74 | exe 'ono <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>' |
Bram Moolenaar | 362e1a3 | 2006-03-06 23:29:24 +0000 | [diff] [blame] | 75 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 76 | setlocal commentstring=/*%s*/ |
| 77 | |
| 78 | " Undo the stuff we changed. |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 79 | let b:undo_ftplugin = "setlocal commentstring< include< omnifunc<" . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 80 | \ " | unlet! b:browsefilter b:match_words | " . |
| 81 | \ s:undo_ftplugin |
| 82 | |
| 83 | " Restore the saved compatibility options. |
Bram Moolenaar | 9a7224b | 2012-04-30 15:56:52 +0200 | [diff] [blame] | 84 | let &cpo = s:keepcpo |
| 85 | unlet s:keepcpo |