home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / xml.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  3.1 KB  |  83 lines

  1. " Vim syntax file
  2. " Language:    XML
  3. " Maintainer:    Paul Siegmann <pauls@euronet.nl>
  4. " URL:        http://www.euronet.nl/~pauls/vim/syntax/xml.vim
  5. " Last change:    1998 May 7
  6.  
  7. " This syntax file will highlight xml tags and arguments.
  8. "
  9. " Currently this is a pre-alpha 'better-then-nothing' version, and I probably
  10. " not going to make any improvements, because it servers my purpose in its
  11. " current form
  12. " In other words, I copied Claudio Fleiner's <claudio@fleiner.com> html.vim
  13. " available from http://www.fleiner.com/vim/syntax/html.vim, 
  14. " and did some global search and replace and stuff.
  15.  
  16. " Remove any old syntax stuff hanging around
  17. syn clear
  18. syn case ignore
  19.  
  20. " Only tags and special chars (ä) are highlighted
  21. " Known tag names and arg names are colored the same way
  22. " as statements and types, while unknwon ones as function.
  23.  
  24. " mark illegal characters
  25. syn match xmlError "[<>&]"
  26.  
  27.  
  28. " tags
  29. syn match   xmlSpecial  contained "\\\d\d\d\|\\."
  30. syn region  xmlString   contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=xmlSpecial
  31. syn region  xmlString   contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=xmlSpecial
  32. syn region  xmlEndTag             start=+</+    end=+>+              contains=xmlTagName,xmlTagError
  33. syn region  xmlTag                start=+<[^/]+ end=+>+              contains=xmlString,xmlTagName,xmlArg,xmlValue,xmlTagError
  34. syn match   xmlTagError contained "[^>]<"ms=s+1
  35.  
  36. " special characters
  37. syn match xmlSpecialChar "&[^;]*;"
  38.  
  39. " server-parsed commands
  40. syn region xmlPreProc start=+<!--#+ end=+-->+
  41.  
  42. " The real comments (this implements the comments as defined by xml,
  43. " but not all xml pages actually conform to it. Errors are flagged.
  44. syn region xmlComment                start=+<!+        end=+>+ contains=xmlCommentPart,xmlCommentError
  45. syn region xmlComment                start=+<!DOCTYPE+ end=+>+
  46. syn match  xmlCommentError contained "[^><!]"
  47. syn region xmlCommentPart  contained start=+--+        end=+--+
  48.  
  49. " synchronizing (does not always work if a comment includes legal
  50. " xml tags, but doing it right would mean to always start
  51. " at the first line, which is too slow)
  52. syn sync match xmlHighlight groupthere NONE "<[/a-zA-Z]"
  53. syn sync match xmlHighlightSkip "^.*['\"].*$"
  54. syn sync minlines=10
  55.  
  56. if !exists("did_xml_syntax_inits")
  57.   let did_xml_syntax_inits = 1
  58.   " The default methods for highlighting.  Can be overridden later
  59.   hi link xmlTag                       Function
  60.   hi link xmlEndTag                    Identifier
  61.   hi link xmlArg                       Type
  62.   hi link xmlTagName                   xmlStatement
  63.   hi link xmlValue                     Value
  64.   hi link xmlSpecialChar               Special
  65.  
  66.   hi link xmlSpecial                   Special
  67.   hi link xmlSpecialChar               Special
  68.   hi link xmlString                    String
  69.   hi link xmlStatement                 Statement
  70.   hi link xmlComment                   Comment
  71.   hi link xmlCommentPart               Comment
  72.   hi link xmlPreProc                   PreProc
  73.   hi link xmlValue                     String
  74.   hi link xmlCommentError              xmlError
  75.   hi link xmlTagError                  xmlError
  76.   hi link xmlError            Error
  77.  
  78. endif
  79.  
  80. let b:current_syntax = "xml"
  81.  
  82. " vim: ts=8
  83.