PageRenderTime 24ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/Misc/Vim/python.vim

https://bitbucket.org/glix/python
Vim Script | 148 lines | 105 code | 36 blank | 7 comment | 12 complexity | 630ad240da6fea19d806713501a34b30 MD5 | raw file
  1. " Auto-generated Vim syntax file for Python (trunk: r60376M).
  2. "
  3. " To use: copy or symlink to ~/.vim/syntax/python.vim
  4. if exists("b:current_syntax")
  5. finish
  6. endif
  7. if exists("python_highlight_all")
  8. let python_highlight_numbers = 1
  9. let python_highlight_builtins = 1
  10. let python_highlight_exceptions = 1
  11. let python_highlight_space_errors = 1
  12. endif
  13. syn keyword pythonStatement as assert break continue del except exec finally
  14. syn keyword pythonStatement global lambda pass print raise return try with
  15. syn keyword pythonStatement yield
  16. syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
  17. syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" contained
  18. syn keyword pythonRepeat for while
  19. syn keyword pythonConditional if elif else
  20. syn keyword pythonOperator and in is not or
  21. syn keyword pythonPreCondit import from
  22. syn match pythonComment "#.*$" contains=pythonTodo
  23. syn keyword pythonTodo TODO FIXME XXX contained
  24. syn region pythonString matchgroup=Normal start=+[uU]\='+ end=+'+ skip=+\\\\\|\\'+ contains=pythonEscape
  25. syn region pythonString matchgroup=Normal start=+[uU]\="+ end=+"+ skip=+\\\\\|\\"+ contains=pythonEscape
  26. syn region pythonString matchgroup=Normal start=+[uU]\="""+ end=+"""+ contains=pythonEscape
  27. syn region pythonString matchgroup=Normal start=+[uU]\='''+ end=+'''+ contains=pythonEscape
  28. syn region pythonString matchgroup=Normal start=+[uU]\=[rR]'+ end=+'+ skip=+\\\\\|\\'+
  29. syn region pythonString matchgroup=Normal start=+[uU]\=[rR]"+ end=+"+ skip=+\\\\\|\\"+
  30. syn region pythonString matchgroup=Normal start=+[uU]\=[rR]"""+ end=+"""+
  31. syn region pythonString matchgroup=Normal start=+[uU]\=[rR]'''+ end=+'''+
  32. syn match pythonEscape +\\[abfnrtv\'"\\]+ contained
  33. syn match pythonEscape "\\\o\{1,3}" contained
  34. syn match pythonEscape "\\x\x\{2}" contained
  35. syn match pythonEscape "\(\\u\x\{4}\|\\U\x\{8}\)" contained
  36. syn match pythonEscape "\\$"
  37. if exists("python_highlight_numbers")
  38. syn match pythonNumber "\<0x\x\+[Ll]\=\>"
  39. syn match pythonNumber "\<\d\+[LljJ]\=\>"
  40. syn match pythonNumber "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
  41. syn match pythonNumber "\<\d\+\.\([eE][+-]\=\d\+\)\=[jJ]\=\>"
  42. syn match pythonNumber "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>"
  43. endif
  44. if exists("python_highlight_builtins")
  45. syn keyword pythonBuiltin Ellipsis False None NotImplemented True __debug__
  46. syn keyword pythonBuiltin __import__ abs all any apply basestring bool
  47. syn keyword pythonBuiltin buffer bytes callable chr classmethod cmp coerce
  48. syn keyword pythonBuiltin compile complex copyright credits delattr dict
  49. syn keyword pythonBuiltin dir divmod enumerate eval execfile exit file
  50. syn keyword pythonBuiltin filter float frozenset getattr globals hasattr
  51. syn keyword pythonBuiltin hash help hex id input int intern isinstance
  52. syn keyword pythonBuiltin issubclass iter len license list locals long map
  53. syn keyword pythonBuiltin max min object oct open ord pow property quit
  54. syn keyword pythonBuiltin range raw_input reduce reload repr reversed round
  55. syn keyword pythonBuiltin set setattr slice sorted staticmethod str sum
  56. syn keyword pythonBuiltin super trunc tuple type unichr unicode vars xrange
  57. syn keyword pythonBuiltin zip
  58. endif
  59. if exists("python_highlight_exceptions")
  60. syn keyword pythonException ArithmeticError AssertionError AttributeError
  61. syn keyword pythonException BaseException DeprecationWarning EOFError
  62. syn keyword pythonException EnvironmentError Exception FloatingPointError
  63. syn keyword pythonException FutureWarning GeneratorExit IOError ImportError
  64. syn keyword pythonException ImportWarning IndentationError IndexError
  65. syn keyword pythonException KeyError KeyboardInterrupt LookupError
  66. syn keyword pythonException MemoryError NameError NotImplementedError
  67. syn keyword pythonException OSError OverflowError PendingDeprecationWarning
  68. syn keyword pythonException ReferenceError RuntimeError RuntimeWarning
  69. syn keyword pythonException StandardError StopIteration SyntaxError
  70. syn keyword pythonException SyntaxWarning SystemError SystemExit TabError
  71. syn keyword pythonException TypeError UnboundLocalError UnicodeDecodeError
  72. syn keyword pythonException UnicodeEncodeError UnicodeError
  73. syn keyword pythonException UnicodeTranslateError UnicodeWarning
  74. syn keyword pythonException UserWarning ValueError Warning
  75. syn keyword pythonException ZeroDivisionError
  76. endif
  77. if exists("python_highlight_space_errors")
  78. syn match pythonSpaceError display excludenl "\S\s\+$"ms=s+1
  79. syn match pythonSpaceError display " \+\t"
  80. syn match pythonSpaceError display "\t\+ "
  81. endif
  82. hi def link pythonStatement Statement
  83. hi def link pythonStatement Statement
  84. hi def link pythonFunction Function
  85. hi def link pythonRepeat Repeat
  86. hi def link pythonConditional Conditional
  87. hi def link pythonOperator Operator
  88. hi def link pythonPreCondit PreCondit
  89. hi def link pythonComment Comment
  90. hi def link pythonTodo Todo
  91. hi def link pythonString String
  92. hi def link pythonEscape Special
  93. hi def link pythonEscape Special
  94. if exists("python_highlight_numbers")
  95. hi def link pythonNumber Number
  96. endif
  97. if exists("python_highlight_builtins")
  98. hi def link pythonBuiltin Function
  99. endif
  100. if exists("python_highlight_exceptions")
  101. hi def link pythonException Exception
  102. endif
  103. if exists("python_highlight_space_errors")
  104. hi def link pythonSpaceError Error
  105. endif
  106. " Uncomment the 'minlines' statement line and comment out the 'maxlines'
  107. " statement line; changes behaviour to look at least 2000 lines previously for
  108. " syntax matches instead of at most 200 lines
  109. syn sync match pythonSync grouphere NONE "):$"
  110. syn sync maxlines=200
  111. "syn sync minlines=2000
  112. let b:current_syntax = "python"