blob: 2824a5853ba94f6923b8e3770382c1fefe002502 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: php
Bram Moolenaar1588bc82022-03-08 21:35:07 +00003"
4" This runtime file is looking for a new maintainer.
5"
6" Former maintainer: Dan Sharp
Bram Moolenaar5c736222010-01-06 20:54:52 +01007" Last Changed: 20 Jan 2009
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9if exists("b:did_ftplugin") | finish | endif
10
11" Make sure the continuation lines below do not cause problems in
12" compatibility mode.
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020013let s:keepcpo= &cpo
14set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000015
16" Define some defaults in case the included ftplugins don't set them.
17let s:undo_ftplugin = ""
Bram Moolenaar8299df92004-07-10 09:47:34 +000018let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000019 \ "All Files (*.*)\t*.*\n"
20let s:match_words = ""
21
22runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
23let b:did_ftplugin = 1
24
25" Override our defaults if these were set by an included ftplugin.
26if exists("b:undo_ftplugin")
27 let s:undo_ftplugin = b:undo_ftplugin
28endif
29if exists("b:browsefilter")
30 let s:browsefilter = b:browsefilter
31endif
32if exists("b:match_words")
33 let s:match_words = b:match_words
34endif
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000035if exists("b:match_skip")
36 unlet b:match_skip
37endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
39" Change the :browse e filter to primarily show PHP-related files.
40if has("gui_win32")
41 let b:browsefilter="PHP Files (*.php)\t*.php\n" . s:browsefilter
42endif
43
44" ###
45" Provided by Mikolaj Machowski <mikmach at wp dot pl>
46setlocal include=\\\(require\\\|include\\\)\\\(_once\\\)\\\?
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000047" Disabled changing 'iskeyword', it breaks a command such as "*"
48" setlocal iskeyword+=$
49
Bram Moolenaar071d4272004-06-13 20:20:40 +000050if exists("loaded_matchit")
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000051 let b:match_words = '<?php:?>,\<switch\>:\<endswitch\>,' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000052 \ '\<if\>:\<elseif\>:\<else\>:\<endif\>,' .
53 \ '\<while\>:\<endwhile\>,' .
54 \ '\<do\>:\<while\>,' .
55 \ '\<for\>:\<endfor\>,' .
56 \ '\<foreach\>:\<endforeach\>,' .
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000057 \ '(:),[:],{:},' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000058 \ s:match_words
59endif
60" ###
61
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000062if exists('&omnifunc')
63 setlocal omnifunc=phpcomplete#CompletePHP
Bram Moolenaar362e1a32006-03-06 23:29:24 +000064endif
65
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000066" Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
67let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
68let s:class = '\(abstract\s\+\|final\s\+\)*class'
69let s:interface = 'interface'
70let s:section = '\(.*\%#\)\@!\_^\s*\zs\('.s:function.'\|'.s:class.'\|'.s:interface.'\)'
71exe 'nno <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
72exe 'nno <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
73exe 'ono <buffer> <silent> [[ ?' . escape(s:section, '|') . '?<CR>:nohls<CR>'
74exe 'ono <buffer> <silent> ]] /' . escape(s:section, '|') . '/<CR>:nohls<CR>'
Bram Moolenaar362e1a32006-03-06 23:29:24 +000075
Bram Moolenaar47c532e2022-03-19 15:18:53 +000076setlocal suffixesadd=.php
Bram Moolenaar071d4272004-06-13 20:20:40 +000077setlocal commentstring=/*%s*/
78
79" Undo the stuff we changed.
Bram Moolenaar47c532e2022-03-19 15:18:53 +000080let b:undo_ftplugin = "setlocal suffixesadd< commentstring< include< omnifunc<" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000081 \ " | unlet! b:browsefilter b:match_words | " .
82 \ s:undo_ftplugin
83
84" Restore the saved compatibility options.
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020085let &cpo = s:keepcpo
86unlet s:keepcpo