Skip to content

Commit 9d1e381

Browse files
tetsuo13vim-scripts
authored andcommitted
Version 1.0: Initial upload
0 parents  commit 9d1e381

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

README

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2548
2+
3+
Extends the PHP syntax highlighting, changing comments when using phpDoc tags to resemble the highlighting found in the Vim Java syntax.

syntax/php.vim

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
" Vim syntax file for extending PHP to use Java-like syntaxing highlighting
2+
" for phpDoc.
3+
"
4+
" Language: php PHP 3/4/5
5+
" Maintainer: Andrei Todhunter <[email protected]>
6+
" Last Change: 2009-02-19
7+
8+
syntax sync fromstart
9+
10+
syntax match phpCommentStar contained "^\s*\*[^/]"me=e-1
11+
syntax match phpCommentStar contained "^\s*\*$"
12+
13+
if !exists("php_ignore_phpdoc")
14+
syntax case ignore
15+
16+
syntax region phpDocComment start="/\*\*" end="\*/" keepend contains=phpCommentTitle,phpDocTags,phpTodo
17+
syntax region phpCommentTitle contained matchgroup=phpDocComment start="/\*\*" matchgroup=phpCommmentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=phpCommentStar,phpTodo,phpDocTags containedin=phpComment
18+
19+
syntax region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpComment
20+
syntax match phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|todo\|tutorial\|uses\|var\|version\)\s\+\S\+" contains=phpDocParam containedin=phpComment
21+
syntax match phpDocParam contained "\s\S\+"
22+
syntax match phpDocTags "@filesource" containedin=phpComment
23+
24+
syntax case match
25+
endif
26+
27+
if version >= 508 || !exists("did_phpdoc_syn_inits")
28+
if version < 508
29+
let did_phpdoc_syn_inits = 1
30+
command! -nargs=+ PhpHiLink hi link <args>
31+
else
32+
command! -nargs=+ PhpHiLink hi def link <args>
33+
endif
34+
35+
PhpHiLink phpCommentTitle SpecialComment
36+
PhpHiLink phpDocComment Comment
37+
PhpHiLink phpDocTags Special
38+
PhpHiLink phpDocParam Function
39+
PhpHiLink phpCommentStar Comment
40+
41+
delcommand PhpHiLink
42+
endif

0 commit comments

Comments
 (0)