jsp.vim 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. " quit when a syntax file was already loaded
  9. if exists("b:current_syntax")
  10. finish
  11. endif
  12. if !exists("main_syntax")
  13. let main_syntax = 'jsp'
  14. endif
  15. " Source HTML syntax
  16. runtime! syntax/html.vim
  17. unlet b:current_syntax
  18. " Next syntax items are case-sensitive
  19. syn case match
  20. " Include Java syntax
  21. syn include @jspJava syntax/java.vim
  22. syn region jspScriptlet matchgroup=jspTag start=/<%/ keepend end=/%>/ contains=@jspJava
  23. syn region jspComment start=/<%--/ end=/--%>/
  24. syn region jspDecl matchgroup=jspTag start=/<%!/ keepend end=/%>/ contains=@jspJava
  25. syn region jspExpr matchgroup=jspTag start=/<%=/ keepend end=/%>/ contains=@jspJava
  26. syn region jspDirective start=/<%@/ end=/%>/ contains=htmlString,jspDirName,jspDirArg
  27. syn keyword jspDirName contained include page taglib
  28. syn keyword jspDirArg contained file uri prefix language extends import session buffer autoFlush
  29. syn keyword jspDirArg contained isThreadSafe info errorPage contentType isErrorPage
  30. syn region jspCommand start=/<jsp:/ start=/<\/jsp:/ keepend end=/>/ end=/\/>/ contains=htmlString,jspCommandName,jspCommandArg
  31. syn keyword jspCommandName contained include forward getProperty plugin setProperty useBean param params fallback
  32. syn keyword jspCommandArg contained id scope class type beanName page flush name value property
  33. syn keyword jspCommandArg contained code codebase name archive align height
  34. syn keyword jspCommandArg contained width hspace vspace jreversion nspluginurl iepluginurl
  35. " Redefine htmlTag so that it can contain jspExpr
  36. syn clear htmlTag
  37. syn region htmlTag start=+<[^/%]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,jspExpr,javaScript
  38. " Define the default highlighting.
  39. " Only when an item doesn't have highlighting yet
  40. " java.vim has redefined htmlComment highlighting
  41. hi def link htmlComment Comment
  42. hi def link htmlCommentPart Comment
  43. " Be consistent with html highlight settings
  44. hi def link jspComment htmlComment
  45. hi def link jspTag htmlTag
  46. hi def link jspDirective jspTag
  47. hi def link jspDirName htmlTagName
  48. hi def link jspDirArg htmlArg
  49. hi def link jspCommand jspTag
  50. hi def link jspCommandName htmlTagName
  51. hi def link jspCommandArg htmlArg
  52. if main_syntax == 'jsp'
  53. unlet main_syntax
  54. endif
  55. let b:current_syntax = "jsp"
  56. " vim: ts=8