7
|
1 " Vim syntax file
|
|
2 " Language: JSP (Java Server Pages)
|
|
3 " Maintainer: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
|
|
4 " URL: http://rgarciasuarez.free.fr/vim/syntax/jsp.vim
|
|
5 " Last change: 2004 Feb 02
|
|
6 " Credits : Patch by Darren Greaves (recognizes <jsp:...> tags)
|
|
7 " Patch by Thomas Kimpton (recognizes jspExpr inside HTML tags)
|
|
8
|
|
9 " For version 5.x: Clear all syntax items
|
|
10 " For version 6.x: Quit when a syntax file was already loaded
|
|
11 if version < 600
|
|
12 syntax clear
|
|
13 elseif exists("b:current_syntax")
|
|
14 finish
|
|
15 endif
|
|
16
|
|
17 if !exists("main_syntax")
|
|
18 let main_syntax = 'jsp'
|
|
19 endif
|
|
20
|
|
21 " Source HTML syntax
|
|
22 if version < 600
|
|
23 source <sfile>:p:h/html.vim
|
|
24 else
|
|
25 runtime! syntax/html.vim
|
|
26 endif
|
|
27 unlet b:current_syntax
|
|
28
|
|
29 " Next syntax items are case-sensitive
|
|
30 syn case match
|
|
31
|
|
32 " Include Java syntax
|
2506
|
33 syn include @jspJava syntax/java.vim
|
7
|
34
|
|
35 syn region jspScriptlet matchgroup=jspTag start=/<%/ keepend end=/%>/ contains=@jspJava
|
|
36 syn region jspComment start=/<%--/ end=/--%>/
|
|
37 syn region jspDecl matchgroup=jspTag start=/<%!/ keepend end=/%>/ contains=@jspJava
|
|
38 syn region jspExpr matchgroup=jspTag start=/<%=/ keepend end=/%>/ contains=@jspJava
|
|
39 syn region jspDirective start=/<%@/ end=/%>/ contains=htmlString,jspDirName,jspDirArg
|
|
40
|
|
41 syn keyword jspDirName contained include page taglib
|
|
42 syn keyword jspDirArg contained file uri prefix language extends import session buffer autoFlush
|
|
43 syn keyword jspDirArg contained isThreadSafe info errorPage contentType isErrorPage
|
|
44 syn region jspCommand start=/<jsp:/ start=/<\/jsp:/ keepend end=/>/ end=/\/>/ contains=htmlString,jspCommandName,jspCommandArg
|
|
45 syn keyword jspCommandName contained include forward getProperty plugin setProperty useBean param params fallback
|
|
46 syn keyword jspCommandArg contained id scope class type beanName page flush name value property
|
|
47 syn keyword jspCommandArg contained code codebase name archive align height
|
|
48 syn keyword jspCommandArg contained width hspace vspace jreversion nspluginurl iepluginurl
|
|
49
|
|
50 " Redefine htmlTag so that it can contain jspExpr
|
2506
|
51 syn clear htmlTag
|
|
52 syn region htmlTag start=+<[^/%]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,jspExpr,javaScript
|
7
|
53
|
|
54 " Define the default highlighting.
|
|
55 " For version 5.7 and earlier: only when not done already
|
|
56 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
57 if version >= 508 || !exists("did_jsp_syn_inits")
|
|
58 if version < 508
|
|
59 let did_jsp_syn_inits = 1
|
|
60 command -nargs=+ HiLink hi link <args>
|
|
61 else
|
|
62 command -nargs=+ HiLink hi def link <args>
|
|
63 endif
|
|
64 " java.vim has redefined htmlComment highlighting
|
|
65 HiLink htmlComment Comment
|
|
66 HiLink htmlCommentPart Comment
|
|
67 " Be consistent with html highlight settings
|
|
68 HiLink jspComment htmlComment
|
|
69 HiLink jspTag htmlTag
|
|
70 HiLink jspDirective jspTag
|
|
71 HiLink jspDirName htmlTagName
|
|
72 HiLink jspDirArg htmlArg
|
|
73 HiLink jspCommand jspTag
|
|
74 HiLink jspCommandName htmlTagName
|
|
75 HiLink jspCommandArg htmlArg
|
|
76 delcommand HiLink
|
|
77 endif
|
|
78
|
|
79 if main_syntax == 'jsp'
|
|
80 unlet main_syntax
|
|
81 endif
|
|
82
|
|
83 let b:current_syntax = "jsp"
|
|
84
|
|
85 " vim: ts=8
|