Mercurial > vim
annotate runtime/indent/php.vim @ 16718:9aa87f5aab55 v8.1.1361
patch 8.1.1361: Python setuptools don't work with Python 3
commit https://github.com/vim/vim/commit/0b0ad35c339b8ad156df493bebeb77e02b32b120
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 20 21:52:45 2019 +0200
patch 8.1.1361: Python setuptools don't work with Python 3
Problem: Python setuptools don't work with Python 3.
Solution: Add dummy implementation for find_module. (Joel Frederico,
closes #4402, closes #3984
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 May 2019 22:00:05 +0200 |
parents | 665fe1f419b0 |
children | 2704c4e3e20a |
rev | line source |
---|---|
7 | 1 " Vim indent file |
2 " Language: PHP | |
409 | 3 " Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> |
4 " URL: http://www.2072productions.com/vim/indent/php.vim | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
5 " Home: https://github.com/2072/PHP-Indenting-for-VIm |
14006 | 6 " Last Change: 2018 May 18th |
7 " Version: 1.66 | |
557 | 8 " |
856 | 9 " |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
10 " Type :help php-indent for available options |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
11 " |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
12 " A fully commented version of this file is available on github |
409 | 13 " |
14 " | |
13950
741b1feeac9f
patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents:
11518
diff
changeset
|
15 " If you find a bug, please open a ticket on github.com |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
16 " ( https://github.com/2072/PHP-Indenting-for-VIm/issues ) with an example of |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
17 " code that breaks the algorithm. |
409 | 18 " |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
19 |
409 | 20 " NOTE: This script must be used with PHP syntax ON and with the php syntax |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
21 " script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the |
1668 | 22 " script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 ) |
2034 | 23 " the later is bunbdled by default with Vim 7. |
409 | 24 " |
25 " | |
1668 | 26 " In the case you have syntax errors in your script such as HereDoc end |
27 " identifiers not at col 1 you'll have to indent your file 2 times (This | |
28 " script will automatically put HereDoc end identifiers at col 1 if | |
29 " they are followed by a ';'). | |
856 | 30 " |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
31 |
2034 | 32 " NOTE: If you are editing files in Unix file format and that (by accident) |
33 " there are '\r' before new lines, this script won't be able to proceed | |
34 " correctly and will make many mistakes because it won't be able to match | |
35 " '\s*$' correctly. | |
36 " So you have to remove those useless characters first with a command like: | |
409 | 37 " |
2034 | 38 " :%s /\r$//g |
7 | 39 " |
2034 | 40 " or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will |
41 " silently remove them when VIM load this script (at each bufread). | |
5862 | 42 |
43 | |
557 | 44 |
7 | 45 if exists("b:did_indent") |
532 | 46 finish |
7 | 47 endif |
48 let b:did_indent = 1 | |
49 | |
409 | 50 |
6421 | 51 let g:php_sync_method = 0 |
409 | 52 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
53 |
409 | 54 if exists("PHP_default_indenting") |
11518 | 55 let b:PHP_default_indenting = PHP_default_indenting * shiftwidth() |
409 | 56 else |
532 | 57 let b:PHP_default_indenting = 0 |
409 | 58 endif |
59 | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
60 if exists("PHP_outdentSLComments") |
11518 | 61 let b:PHP_outdentSLComments = PHP_outdentSLComments * shiftwidth() |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
62 else |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
63 let b:PHP_outdentSLComments = 0 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
64 endif |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
65 |
409 | 66 if exists("PHP_BracesAtCodeLevel") |
532 | 67 let b:PHP_BracesAtCodeLevel = PHP_BracesAtCodeLevel |
409 | 68 else |
532 | 69 let b:PHP_BracesAtCodeLevel = 0 |
409 | 70 endif |
71 | |
1668 | 72 |
557 | 73 if exists("PHP_autoformatcomment") |
74 let b:PHP_autoformatcomment = PHP_autoformatcomment | |
75 else | |
76 let b:PHP_autoformatcomment = 1 | |
77 endif | |
7 | 78 |
2442 | 79 if exists("PHP_outdentphpescape") |
80 let b:PHP_outdentphpescape = PHP_outdentphpescape | |
81 else | |
82 let b:PHP_outdentphpescape = 1 | |
83 endif | |
84 | |
14006 | 85 if exists("PHP_noArrowMatching") |
86 let b:PHP_noArrowMatching = PHP_noArrowMatching | |
87 else | |
88 let b:PHP_noArrowMatching = 0 | |
89 endif | |
90 | |
2442 | 91 |
92 if exists("PHP_vintage_case_default_indent") && PHP_vintage_case_default_indent | |
93 let b:PHP_vintage_case_default_indent = 1 | |
1668 | 94 else |
95 let b:PHP_vintage_case_default_indent = 0 | |
96 endif | |
97 | |
98 | |
99 | |
409 | 100 let b:PHP_lastindented = 0 |
101 let b:PHP_indentbeforelast = 0 | |
102 let b:PHP_indentinghuge = 0 | |
103 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
104 let b:PHP_LastIndentedWasComment = 0 | |
105 let b:PHP_InsideMultilineComment = 0 | |
106 let b:InPHPcode = 0 | |
107 let b:InPHPcode_checked = 0 | |
108 let b:InPHPcode_and_script = 0 | |
109 let b:InPHPcode_tofind = "" | |
110 let b:PHP_oldchangetick = b:changedtick | |
111 let b:UserIsTypingComment = 0 | |
112 let b:optionsset = 0 | |
113 | |
114 setlocal nosmartindent | |
856 | 115 setlocal noautoindent |
409 | 116 setlocal nocindent |
532 | 117 setlocal nolisp |
409 | 118 |
119 setlocal indentexpr=GetPhpIndent() | |
6421 | 120 setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=?>,=<?,=*/ |
409 | 121 |
122 | |
532 | 123 |
124 let s:searchpairflags = 'bWr' | |
409 | 125 |
126 if &fileformat == "unix" && exists("PHP_removeCRwhenUnix") && PHP_removeCRwhenUnix | |
532 | 127 silent! %s/\r$//g |
409 | 128 endif |
129 | |
7 | 130 if exists("*GetPhpIndent") |
2034 | 131 call ResetPhpOptions() |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
132 finish |
7 | 133 endif |
134 | |
5862 | 135 |
6421 | 136 let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' |
5862 | 137 let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)' |
138 let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' | |
14006 | 139 let s:functionDecl = '\<function\>\%(\s\+&\='.s:PHP_validVariable.'\)\=\s*(.*' |
11262 | 140 let s:endline = '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' |
141 let s:unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.s:endline | |
6421 | 142 |
143 | |
11262 | 144 let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)' |
409 | 145 let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' |
11262 | 146 let s:structureHead = '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline . '\|\<new\s\+class\>' |
409 | 147 |
148 | |
5862 | 149 let s:escapeDebugStops = 0 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
150 function! DebugPrintReturn(scriptLine) |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
151 |
6421 | 152 if ! s:escapeDebugStops |
5862 | 153 echo "debug:" . a:scriptLine |
154 let c = getchar() | |
155 if c == "\<Del>" | |
156 let s:escapeDebugStops = 1 | |
157 end | |
158 endif | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
159 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
160 endfunction |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
161 |
409 | 162 function! GetLastRealCodeLNum(startline) " {{{ |
856 | 163 |
532 | 164 let lnum = a:startline |
856 | 165 |
631 | 166 if b:GetLastRealCodeLNum_ADD && b:GetLastRealCodeLNum_ADD == lnum + 1 |
167 let lnum = b:GetLastRealCodeLNum_ADD | |
168 endif | |
856 | 169 |
532 | 170 while lnum > 1 |
171 let lnum = prevnonblank(lnum) | |
172 let lastline = getline(lnum) | |
409 | 173 |
532 | 174 if b:InPHPcode_and_script && lastline =~ '?>\s*$' |
175 let lnum = lnum - 1 | |
176 elseif lastline =~ '^\s*?>.*<?\%(php\)\=\s*$' | |
177 let lnum = lnum - 1 | |
178 elseif lastline =~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)' | |
179 let lnum = lnum - 1 | |
180 elseif lastline =~ '\*/\s*$' | |
181 call cursor(lnum, 1) | |
182 if lastline !~ '^\*/' | |
183 call search('\*/', 'W') | |
184 endif | |
557 | 185 let lnum = searchpair('/\*', '', '\*/', s:searchpairflags, 'Skippmatch2()') |
409 | 186 |
532 | 187 let lastline = getline(lnum) |
188 if lastline =~ '^\s*/\*' | |
189 let lnum = lnum - 1 | |
190 else | |
191 break | |
192 endif | |
409 | 193 |
194 | |
532 | 195 elseif lastline =~? '\%(//\s*\|?>.*\)\@<!<?\%(php\)\=\s*$\|^\s*<script\>' |
196 | |
197 while lastline !~ '\(<?.*\)\@<!?>' && lnum > 1 | |
198 let lnum = lnum - 1 | |
199 let lastline = getline(lnum) | |
200 endwhile | |
201 if lastline =~ '^\s*?>' | |
202 let lnum = lnum - 1 | |
203 else | |
204 break | |
205 endif | |
206 | |
409 | 207 |
2442 | 208 elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
209 let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '') |
532 | 210 while getline(lnum) !~? tofind && lnum > 1 |
211 let lnum = lnum - 1 | |
212 endwhile | |
5862 | 213 elseif lastline =~ '^[^''"`]*[''"`][;,]'.s:endline |
11262 | 214 |
215 let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$\\|^[^\1]\\+[=([]\\s*[\1]', '') | |
216 let trylnum = lnum | |
217 while getline(trylnum) !~? tofind && trylnum > 1 | |
218 let trylnum = trylnum - 1 | |
5862 | 219 endwhile |
11262 | 220 |
221 if trylnum == 1 | |
222 break | |
223 else | |
224 if lastline =~ ';'.s:endline | |
225 while getline(trylnum) !~? s:terminated && getline(trylnum) !~? '{'.s:endline && trylnum > 1 | |
226 let trylnum = prevnonblank(trylnum - 1) | |
227 endwhile | |
228 | |
229 | |
230 if trylnum == 1 | |
231 break | |
232 end | |
233 end | |
234 let lnum = trylnum | |
235 end | |
532 | 236 else |
856 | 237 break |
409 | 238 endif |
532 | 239 endwhile |
240 | |
2442 | 241 if lnum==1 && getline(lnum) !~ '<?' |
532 | 242 let lnum=0 |
243 endif | |
244 | |
6421 | 245 if b:InPHPcode_and_script && 1 > b:InPHPcode |
532 | 246 let b:InPHPcode_and_script = 0 |
247 endif | |
1120 | 248 |
532 | 249 return lnum |
250 endfunction " }}} | |
409 | 251 |
557 | 252 function! Skippmatch2() |
253 | |
254 let line = getline(".") | |
255 | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
256 if line =~ "\\([\"']\\).*/\\*.*\\1" || line =~ '\%(//\|#\).*/\*' |
5862 | 257 return 1 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
258 else |
5862 | 259 return 0 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
260 endif |
557 | 261 endfun |
262 | |
2442 | 263 function! Skippmatch() " {{{ |
532 | 264 let synname = synIDattr(synID(line("."), col("."), 0), "name") |
14006 | 265 if synname ==? "Delimiter" || synname ==? "phpRegionDelimiter" || synname =~? "^phpParent" || synname ==? "phpArrayParens" || synname =~? '^php\%(Block\|Brace\)' || synname ==? "javaScriptBraces" || synname =~? '^php\%(Doc\)\?Comment' && b:UserIsTypingComment |
532 | 266 return 0 |
267 else | |
268 return 1 | |
269 endif | |
270 endfun " }}} | |
409 | 271 |
5862 | 272 function! FindOpenBracket(lnum, blockStarter) " {{{ |
532 | 273 call cursor(a:lnum, 1) |
5862 | 274 let line = searchpair('{', '', '}', 'bW', 'Skippmatch()') |
275 | |
276 if a:blockStarter == 1 | |
6421 | 277 while line > 1 |
5862 | 278 let linec = getline(line) |
279 | |
11262 | 280 if linec =~ s:terminated || linec =~ s:structureHead |
5862 | 281 break |
282 endif | |
283 | |
284 let line = GetLastRealCodeLNum(line - 1) | |
285 endwhile | |
286 endif | |
287 | |
288 return line | |
532 | 289 endfun " }}} |
409 | 290 |
11262 | 291 let s:blockChars = {'{':1, '[': 1, '(': 1, ')':-1, ']':-1, '}':-1} |
292 function! BalanceDirection (str) | |
293 | |
294 let balance = 0 | |
295 | |
296 for c in split(a:str, '\zs') | |
297 if has_key(s:blockChars, c) | |
298 let balance += s:blockChars[c] | |
299 endif | |
300 endfor | |
301 | |
302 return balance | |
303 endfun | |
304 | |
14006 | 305 function! StripEndlineComments (line) |
306 return substitute(a:line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') | |
307 endfun | |
308 | |
309 function! FindArrowIndent (lnum) " {{{ | |
310 | |
311 let parrentArrowPos = 0 | |
312 let lnum = a:lnum | |
313 while lnum > 1 | |
314 let last_line = getline(lnum) | |
315 if last_line =~ '^\s*->' | |
316 let parrentArrowPos = indent(a:lnum) | |
317 break | |
318 else | |
319 call cursor(lnum, 1) | |
320 let cleanedLnum = StripEndlineComments(last_line) | |
321 if cleanedLnum =~ '->' | |
322 if ! b:PHP_noArrowMatching | |
323 let parrentArrowPos = searchpos('->', 'W', lnum)[1] - 1 | |
324 else | |
325 let parrentArrowPos = indent(lnum) + shiftwidth() | |
326 endif | |
327 break | |
328 elseif cleanedLnum =~ ')'.s:endline && BalanceDirection(last_line) < 0 | |
329 call searchpos(')'.s:endline, 'cW', lnum) | |
330 let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') | |
331 if openedparent != lnum | |
332 let lnum = openedparent | |
333 else | |
334 let openedparent = -1 | |
335 endif | |
336 | |
337 else | |
338 let parrentArrowPos = indent(lnum) + shiftwidth() | |
339 break | |
340 endif | |
341 endif | |
342 endwhile | |
343 | |
344 return parrentArrowPos | |
345 endfun "}}} | |
346 | |
409 | 347 function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{ |
532 | 348 |
349 if getline(a:lnum) =~# '^\s*}\s*else\%(if\)\=\>' | |
350 let beforeelse = a:lnum | |
351 else | |
352 let beforeelse = GetLastRealCodeLNum(a:lnum - 1) | |
353 endif | |
409 | 354 |
532 | 355 if !s:level |
356 let s:iftoskip = 0 | |
357 endif | |
358 | |
359 if getline(beforeelse) =~# '^\s*\%(}\s*\)\=else\%(\s*if\)\@!\>' | |
360 let s:iftoskip = s:iftoskip + 1 | |
361 endif | |
362 | |
363 if getline(beforeelse) =~ '^\s*}' | |
5862 | 364 let beforeelse = FindOpenBracket(beforeelse, 0) |
532 | 365 |
366 if getline(beforeelse) =~ '^\s*{' | |
367 let beforeelse = GetLastRealCodeLNum(beforeelse - 1) | |
409 | 368 endif |
532 | 369 endif |
409 | 370 |
371 | |
532 | 372 if !s:iftoskip && a:StopAfterFirstPrevElse && getline(beforeelse) =~# '^\s*\%([}]\s*\)\=else\%(if\)\=\>' |
373 return beforeelse | |
374 endif | |
375 | |
376 if getline(beforeelse) !~# '^\s*if\>' && beforeelse>1 || s:iftoskip && beforeelse>1 | |
377 | |
2442 | 378 if s:iftoskip && getline(beforeelse) =~# '^\s*if\>' |
532 | 379 let s:iftoskip = s:iftoskip - 1 |
409 | 380 endif |
381 | |
532 | 382 let s:level = s:level + 1 |
383 let beforeelse = FindTheIfOfAnElse(beforeelse, a:StopAfterFirstPrevElse) | |
384 endif | |
409 | 385 |
532 | 386 return beforeelse |
409 | 387 |
532 | 388 endfunction " }}} |
409 | 389 |
2442 | 390 let s:defaultORcase = '^\s*\%(default\|case\).*:' |
391 | |
392 function! FindTheSwitchIndent (lnum) " {{{ | |
393 | |
394 let test = GetLastRealCodeLNum(a:lnum - 1) | |
395 | |
396 if test <= 1 | |
11518 | 397 return indent(1) - shiftwidth() * b:PHP_vintage_case_default_indent |
2442 | 398 end |
399 | |
5862 | 400 while getline(test) =~ '^\s*}' && test > 1 |
401 let test = GetLastRealCodeLNum(FindOpenBracket(test, 0) - 1) | |
2442 | 402 |
5862 | 403 if getline(test) =~ '^\s*switch\>' |
404 let test = GetLastRealCodeLNum(test - 1) | |
2442 | 405 endif |
5862 | 406 endwhile |
2442 | 407 |
408 if getline(test) =~# '^\s*switch\>' | |
409 return indent(test) | |
410 elseif getline(test) =~# s:defaultORcase | |
11518 | 411 return indent(test) - shiftwidth() * b:PHP_vintage_case_default_indent |
2442 | 412 else |
413 return FindTheSwitchIndent(test) | |
414 endif | |
415 | |
416 endfunction "}}} | |
417 | |
14006 | 418 let s:SynPHPMatchGroups = {'phpparent':1, 'delimiter':1, 'define':1, 'storageclass':1, 'structure':1, 'exception':1} |
409 | 419 function! IslinePHP (lnum, tofind) " {{{ |
532 | 420 let cline = getline(a:lnum) |
409 | 421 |
532 | 422 if a:tofind=="" |
5862 | 423 let tofind = "^\\s*[\"'`]*\\s*\\zs\\S" |
532 | 424 else |
425 let tofind = a:tofind | |
426 endif | |
409 | 427 |
532 | 428 let tofind = tofind . '\c' |
409 | 429 |
532 | 430 let coltotest = match (cline, tofind) + 1 |
431 | |
432 let synname = synIDattr(synID(a:lnum, coltotest, 0), "name") | |
409 | 433 |
14006 | 434 if synname ==? 'phpStringSingle' || synname ==? 'phpStringDouble' || synname ==? 'phpBacktick' |
5862 | 435 if cline !~ '^\s*[''"`]' |
6421 | 436 return "SpecStringEntrails" |
5862 | 437 else |
438 return synname | |
439 end | |
440 end | |
441 | |
14006 | 442 if get(s:SynPHPMatchGroups, tolower(synname)) || synname =~ '^php' || synname =~? '^javaScript' |
532 | 443 return synname |
444 else | |
445 return "" | |
446 endif | |
447 endfunction " }}} | |
409 | 448 |
2034 | 449 let s:autoresetoptions = 0 |
450 if ! s:autoresetoptions | |
451 let s:autoresetoptions = 1 | |
7 | 452 endif |
453 | |
2034 | 454 function! ResetPhpOptions() |
6421 | 455 if ! b:optionsset && &filetype =~ "php" |
557 | 456 if b:PHP_autoformatcomment |
457 | |
458 setlocal comments=s1:/*,mb:*,ex:*/,://,:# | |
856 | 459 |
1668 | 460 setlocal formatoptions-=t |
557 | 461 setlocal formatoptions+=q |
462 setlocal formatoptions+=r | |
463 setlocal formatoptions+=o | |
464 setlocal formatoptions+=c | |
465 setlocal formatoptions+=b | |
466 endif | |
532 | 467 let b:optionsset = 1 |
468 endif | |
409 | 469 endfunc |
470 | |
2034 | 471 call ResetPhpOptions() |
472 | |
14006 | 473 function! GetPhpIndentVersion() |
474 return "1.66-bundle" | |
475 endfun | |
476 | |
409 | 477 function! GetPhpIndent() |
478 | |
631 | 479 let b:GetLastRealCodeLNum_ADD = 0 |
480 | |
532 | 481 let UserIsEditing=0 |
482 if b:PHP_oldchangetick != b:changedtick | |
483 let b:PHP_oldchangetick = b:changedtick | |
484 let UserIsEditing=1 | |
485 endif | |
409 | 486 |
532 | 487 if b:PHP_default_indenting |
11518 | 488 let b:PHP_default_indenting = g:PHP_default_indenting * shiftwidth() |
532 | 489 endif |
490 | |
491 let cline = getline(v:lnum) | |
409 | 492 |
856 | 493 if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast |
532 | 494 if b:PHP_indentbeforelast |
495 let b:PHP_indentinghuge = 1 | |
496 endif | |
497 let b:PHP_indentbeforelast = b:PHP_lastindented | |
498 endif | |
409 | 499 |
532 | 500 if b:InPHPcode_checked && prevnonblank(v:lnum - 1) != b:PHP_lastindented |
501 if b:PHP_indentinghuge | |
502 let b:PHP_indentinghuge = 0 | |
503 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
409 | 504 endif |
6421 | 505 let real_PHP_lastindented = v:lnum |
532 | 506 let b:PHP_LastIndentedWasComment=0 |
507 let b:PHP_InsideMultilineComment=0 | |
508 let b:PHP_indentbeforelast = 0 | |
409 | 509 |
532 | 510 let b:InPHPcode = 0 |
511 let b:InPHPcode_checked = 0 | |
512 let b:InPHPcode_and_script = 0 | |
513 let b:InPHPcode_tofind = "" | |
409 | 514 |
532 | 515 elseif v:lnum > b:PHP_lastindented |
516 let real_PHP_lastindented = b:PHP_lastindented | |
6421 | 517 else |
518 let real_PHP_lastindented = v:lnum | |
532 | 519 endif |
409 | 520 |
6421 | 521 let b:PHP_lastindented = v:lnum |
522 | |
409 | 523 |
532 | 524 if !b:InPHPcode_checked " {{{ One time check |
525 let b:InPHPcode_checked = 1 | |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
526 let b:UserIsTypingComment = 0 |
409 | 527 |
631 | 528 let synname = "" |
529 if cline !~ '<?.*?>' | |
530 let synname = IslinePHP (prevnonblank(v:lnum), "") | |
531 endif | |
409 | 532 |
532 | 533 if synname!="" |
14006 | 534 if synname ==? "SpecStringEntrails" |
11262 | 535 let b:InPHPcode = -1 " thumb down |
6421 | 536 let b:InPHPcode_tofind = "" |
14006 | 537 elseif synname !=? "phpHereDoc" && synname !=? "phpHereDocDelimiter" |
532 | 538 let b:InPHPcode = 1 |
539 let b:InPHPcode_tofind = "" | |
409 | 540 |
14006 | 541 if synname =~? '^php\%(Doc\)\?Comment' |
532 | 542 let b:UserIsTypingComment = 1 |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
543 let b:InPHPcode_checked = 0 |
409 | 544 endif |
545 | |
532 | 546 if synname =~? '^javaScript' |
547 let b:InPHPcode_and_script = 1 | |
548 endif | |
409 | 549 |
532 | 550 else |
551 let b:InPHPcode = 0 | |
409 | 552 |
532 | 553 let lnum = v:lnum - 1 |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
554 while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1 |
532 | 555 let lnum = lnum - 1 |
556 endwhile | |
409 | 557 |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
558 let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') |
532 | 559 endif |
560 else | |
561 let b:InPHPcode = 0 | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
562 let b:InPHPcode_tofind = s:PHP_startindenttag |
409 | 563 endif |
532 | 564 endif "!b:InPHPcode_checked }}} |
409 | 565 |
566 | |
532 | 567 " Test if we are indenting PHP code {{{ |
568 let lnum = prevnonblank(v:lnum - 1) | |
569 let last_line = getline(lnum) | |
5862 | 570 let endline= s:endline |
409 | 571 |
532 | 572 if b:InPHPcode_tofind!="" |
573 if cline =~? b:InPHPcode_tofind | |
574 let b:InPHPcode_tofind = "" | |
575 let b:UserIsTypingComment = 0 | |
6421 | 576 |
577 if b:InPHPcode == -1 | |
578 let b:InPHPcode = 1 | |
579 return -1 | |
580 end | |
581 | |
582 let b:InPHPcode = 1 | |
583 | |
532 | 584 if cline =~ '\*/' |
409 | 585 call cursor(v:lnum, 1) |
532 | 586 if cline !~ '^\*/' |
587 call search('\*/', 'W') | |
588 endif | |
557 | 589 let lnum = searchpair('/\*', '', '\*/', s:searchpairflags, 'Skippmatch2()') |
409 | 590 |
591 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
592 | |
532 | 593 let b:PHP_LastIndentedWasComment = 0 |
409 | 594 |
532 | 595 if cline =~ '^\s*\*/' |
596 return indent(lnum) + 1 | |
597 else | |
598 return indent(lnum) | |
7 | 599 endif |
532 | 600 |
601 elseif cline =~? '<script\>' | |
602 let b:InPHPcode_and_script = 1 | |
631 | 603 let b:GetLastRealCodeLNum_ADD = v:lnum |
532 | 604 endif |
7 | 605 endif |
532 | 606 endif |
409 | 607 |
6421 | 608 if 1 == b:InPHPcode |
409 | 609 |
14006 | 610 if !b:InPHPcode_and_script && last_line =~ '\%(<?.*\)\@<!?>\%(.*<?\)\@!' && IslinePHP(lnum, '?>')=~?"Delimiter" |
532 | 611 if cline !~? s:PHP_startindenttag |
612 let b:InPHPcode = 0 | |
613 let b:InPHPcode_tofind = s:PHP_startindenttag | |
614 elseif cline =~? '<script\>' | |
615 let b:InPHPcode_and_script = 1 | |
616 endif | |
409 | 617 |
11262 | 618 elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before |
6421 | 619 let b:InPHPcode = -1 |
5862 | 620 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
621 elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' |
532 | 622 let b:InPHPcode = 0 |
7992
78106b0f2c56
commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a
Christian Brabandt <cb@256bit.org>
parents:
6421
diff
changeset
|
623 let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') |
532 | 624 |
625 elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*' | |
626 let b:InPHPcode = 0 | |
627 let b:InPHPcode_tofind = '\*/' | |
409 | 628 |
532 | 629 elseif cline =~? '^\s*</script>' |
630 let b:InPHPcode = 0 | |
631 let b:InPHPcode_tofind = s:PHP_startindenttag | |
632 endif | |
633 endif " }}} | |
634 | |
856 | 635 |
6421 | 636 if 1 > b:InPHPcode && !b:InPHPcode_and_script |
532 | 637 return -1 |
638 endif | |
409 | 639 |
532 | 640 " Indent successive // or # comment the same way the first is {{{ |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
641 let addSpecial = 0 |
532 | 642 if cline =~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)' |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
643 let addSpecial = b:PHP_outdentSLComments |
532 | 644 if b:PHP_LastIndentedWasComment == 1 |
645 return indent(real_PHP_lastindented) | |
646 endif | |
647 let b:PHP_LastIndentedWasComment = 1 | |
648 else | |
649 let b:PHP_LastIndentedWasComment = 0 | |
650 endif " }}} | |
651 | |
652 " Indent multiline /* comments correctly {{{ | |
653 | |
654 if b:PHP_InsideMultilineComment || b:UserIsTypingComment | |
655 if cline =~ '^\s*\*\%(\/\)\@!' | |
656 if last_line =~ '^\s*/\*' | |
657 return indent(lnum) + 1 | |
658 else | |
659 return indent(lnum) | |
660 endif | |
661 else | |
662 let b:PHP_InsideMultilineComment = 0 | |
663 endif | |
664 endif | |
665 | |
6421 | 666 if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*\%(.*\*/\)\@!' |
631 | 667 if getline(v:lnum + 1) !~ '^\s*\*' |
668 return -1 | |
669 endif | |
532 | 670 let b:PHP_InsideMultilineComment = 1 |
671 endif " }}} | |
409 | 672 |
673 | |
532 | 674 " Things always indented at col 1 (PHP delimiter: <?, ?>, Heredoc end) {{{ |
2442 | 675 if cline =~# '^\s*<?' && cline !~ '?>' && b:PHP_outdentphpescape |
532 | 676 return 0 |
677 endif | |
409 | 678 |
2442 | 679 if cline =~ '^\s*?>' && cline !~# '<?' && b:PHP_outdentphpescape |
532 | 680 return 0 |
681 endif | |
409 | 682 |
5862 | 683 if cline =~? '^\s*\a\w*;$\|^\a\w*$\|^\s*[''"`][;,]' && cline !~? s:notPhpHereDoc |
532 | 684 return 0 |
685 endif " }}} | |
409 | 686 |
532 | 687 let s:level = 0 |
409 | 688 |
532 | 689 let lnum = GetLastRealCodeLNum(v:lnum - 1) |
631 | 690 |
532 | 691 let last_line = getline(lnum) |
692 let ind = indent(lnum) | |
409 | 693 |
532 | 694 if ind==0 && b:PHP_default_indenting |
695 let ind = b:PHP_default_indenting | |
696 endif | |
409 | 697 |
532 | 698 if lnum == 0 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
699 return b:PHP_default_indenting + addSpecial |
532 | 700 endif |
409 | 701 |
702 | |
532 | 703 if cline =~ '^\s*}\%(}}\)\@!' |
5862 | 704 let ind = indent(FindOpenBracket(v:lnum, 1)) |
532 | 705 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting |
706 return ind | |
707 endif | |
409 | 708 |
532 | 709 if cline =~ '^\s*\*/' |
710 call cursor(v:lnum, 1) | |
711 if cline !~ '^\*/' | |
712 call search('\*/', 'W') | |
713 endif | |
557 | 714 let lnum = searchpair('/\*', '', '\*/', s:searchpairflags, 'Skippmatch2()') |
532 | 715 |
716 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
409 | 717 |
532 | 718 if cline =~ '^\s*\*/' |
719 return indent(lnum) + 1 | |
720 else | |
721 return indent(lnum) | |
722 endif | |
723 endif | |
724 | |
725 | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
726 if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase |
532 | 727 if ind==b:PHP_default_indenting |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
728 return b:PHP_default_indenting + addSpecial |
532 | 729 elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
730 return b:PHP_CurrentIndentLevel + addSpecial |
532 | 731 endif |
732 endif | |
733 | |
734 let LastLineClosed = 0 | |
735 | |
5862 | 736 let terminated = s:terminated |
532 | 737 |
11262 | 738 let unstated = s:unstated |
739 | |
409 | 740 |
532 | 741 if ind != b:PHP_default_indenting && cline =~# '^\s*else\%(if\)\=\>' |
742 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
743 return indent(FindTheIfOfAnElse(v:lnum, 1)) | |
2442 | 744 elseif cline =~# s:defaultORcase |
11518 | 745 return FindTheSwitchIndent(v:lnum) + shiftwidth() * b:PHP_vintage_case_default_indent |
1668 | 746 elseif cline =~ '^\s*)\=\s*{' |
532 | 747 let previous_line = last_line |
748 let last_line_num = lnum | |
749 | |
750 while last_line_num > 1 | |
751 | |
11262 | 752 if previous_line =~ terminated || previous_line =~ s:structureHead |
532 | 753 |
754 let ind = indent(last_line_num) | |
755 | |
756 if b:PHP_BracesAtCodeLevel | |
11518 | 757 let ind = ind + shiftwidth() |
532 | 758 endif |
759 | |
856 | 760 return ind |
532 | 761 endif |
762 | |
5862 | 763 let last_line_num = GetLastRealCodeLNum(last_line_num - 1) |
532 | 764 let previous_line = getline(last_line_num) |
765 endwhile | |
14006 | 766 elseif cline =~ '^\s*->' |
767 return FindArrowIndent(lnum) | |
1668 | 768 elseif last_line =~# unstated && cline !~ '^\s*);\='.endline |
11518 | 769 let ind = ind + shiftwidth() " we indent one level further when the preceding line is not stated |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
770 return ind + addSpecial |
532 | 771 |
6421 | 772 elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated |
532 | 773 let previous_line = last_line |
774 let last_line_num = lnum | |
775 let LastLineClosed = 1 | |
776 | |
5862 | 777 let isSingleLineBlock = 0 |
532 | 778 while 1 |
14006 | 779 if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline |
532 | 780 |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
781 call cursor(last_line_num, 1) |
5862 | 782 if previous_line !~ '^}' |
783 call search('}\|;\s*}'.endline, 'W') | |
784 end | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
785 let oldLastLine = last_line_num |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
786 let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()') |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
787 |
5862 | 788 if getline(last_line_num) =~ '^\s*{' |
532 | 789 let last_line_num = GetLastRealCodeLNum(last_line_num - 1) |
5862 | 790 elseif oldLastLine == last_line_num |
791 let isSingleLineBlock = 1 | |
792 continue | |
409 | 793 endif |
532 | 794 |
795 let previous_line = getline(last_line_num) | |
7 | 796 |
532 | 797 continue |
798 else | |
5862 | 799 let isSingleLineBlock = 0 |
409 | 800 |
532 | 801 if getline(last_line_num) =~# '^\s*else\%(if\)\=\>' |
802 let last_line_num = FindTheIfOfAnElse(last_line_num, 0) | |
803 continue | |
804 endif | |
409 | 805 |
806 | |
532 | 807 let last_match = last_line_num |
409 | 808 |
532 | 809 let one_ahead_indent = indent(last_line_num) |
810 let last_line_num = GetLastRealCodeLNum(last_line_num - 1) | |
811 let two_ahead_indent = indent(last_line_num) | |
812 let after_previous_line = previous_line | |
813 let previous_line = getline(last_line_num) | |
409 | 814 |
815 | |
2442 | 816 if previous_line =~# s:defaultORcase.'\|{'.endline |
532 | 817 break |
818 endif | |
409 | 819 |
532 | 820 if after_previous_line=~# '^\s*'.s:blockstart.'.*)'.endline && previous_line =~# '[;}]'.endline |
821 break | |
7 | 822 endif |
409 | 823 |
856 | 824 if one_ahead_indent == two_ahead_indent || last_line_num < 1 |
1668 | 825 if previous_line =~# '\%(;\|^\s*}\)'.endline || last_line_num < 1 |
532 | 826 break |
827 endif | |
828 endif | |
829 endif | |
830 endwhile | |
831 | |
832 if indent(last_match) != ind | |
833 let ind = indent(last_match) | |
834 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting | |
835 | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
836 return ind + addSpecial |
532 | 837 endif |
838 endif | |
839 | |
6421 | 840 if (last_line !~ '^\s*}\%(}}\)\@!') |
841 let plinnum = GetLastRealCodeLNum(lnum - 1) | |
842 else | |
843 let plinnum = GetLastRealCodeLNum(FindOpenBracket(lnum, 1) - 1) | |
844 endif | |
845 | |
2442 | 846 let AntepenultimateLine = getline(plinnum) |
532 | 847 |
14006 | 848 let last_line = StripEndlineComments(last_line) |
532 | 849 |
850 if ind == b:PHP_default_indenting | |
6421 | 851 if last_line =~ terminated && last_line !~# s:defaultORcase |
532 | 852 let LastLineClosed = 1 |
853 endif | |
854 endif | |
855 | |
856 if !LastLineClosed | |
857 | |
14006 | 858 let openedparent = -1 |
859 | |
2034 | 860 |
11262 | 861 if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline && BalanceDirection(last_line) > 0 |
532 | 862 |
5862 | 863 let dontIndent = 0 |
14006 | 864 if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*[)\]]\+\(\s*:\s*'.s:PHP_validVariable.'\)\=\s*{'.endline && last_line !~ s:structureHead |
5862 | 865 let dontIndent = 1 |
866 endif | |
867 | |
868 if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{') | |
11518 | 869 let ind = ind + shiftwidth() |
532 | 870 endif |
871 | |
2442 | 872 if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 |
532 | 873 let b:PHP_CurrentIndentLevel = ind |
1668 | 874 |
532 | 875 endif |
876 | |
14006 | 877 elseif last_line =~ '),'.endline && BalanceDirection(last_line) < 0 |
532 | 878 call cursor(lnum, 1) |
14006 | 879 call searchpos('),'.endline, 'cW') |
532 | 880 let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') |
881 if openedparent != lnum | |
882 let ind = indent(openedparent) | |
883 endif | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
884 |
14006 | 885 elseif last_line =~ s:structureHead |
11518 | 886 let ind = ind + shiftwidth() |
1668 | 887 |
532 | 888 |
11262 | 889 elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase |
11518 | 890 let ind = ind + shiftwidth() |
409 | 891 endif |
7 | 892 |
14006 | 893 |
894 if openedparent >= 0 | |
895 let last_line = StripEndlineComments(getline(openedparent)) | |
896 endif | |
532 | 897 endif |
409 | 898 |
14006 | 899 if cline =~ '^\s*[)\]];\=' |
900 let ind = ind - shiftwidth() | |
901 endif | |
902 | |
903 if last_line =~ '^\s*->' && last_line !~? s:structureHead && BalanceDirection(last_line) <= 0 | |
11518 | 904 let ind = ind - shiftwidth() |
532 | 905 endif |
906 | |
907 let b:PHP_CurrentIndentLevel = ind | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2442
diff
changeset
|
908 return ind + addSpecial |
7 | 909 endfunction |