PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Misc/Vim/python.vim

https://github.com/seanjensengrey/CPython
Vim Script | 149 lines | 106 code | 36 blank | 7 comment | 12 complexity | 5a6bec975f209eff2ce385c4a9cb493e MD5 | raw file
  1. " Auto-generated Vim syntax file for Python (trunk: r80490).
  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 bin bool
  47. syn keyword pythonBuiltin buffer bytearray bytes callable chr classmethod
  48. syn keyword pythonBuiltin cmp coerce compile complex copyright credits
  49. syn keyword pythonBuiltin delattr dict dir divmod enumerate eval execfile
  50. syn keyword pythonBuiltin exit file filter float format frozenset getattr
  51. syn keyword pythonBuiltin globals hasattr hash help hex id input int intern
  52. syn keyword pythonBuiltin isinstance issubclass iter len license list
  53. syn keyword pythonBuiltin locals long map max memoryview min next object
  54. syn keyword pythonBuiltin oct open ord pow print property quit range
  55. syn keyword pythonBuiltin raw_input reduce reload repr reversed round set
  56. syn keyword pythonBuiltin setattr slice sorted staticmethod str sum super
  57. syn keyword pythonBuiltin tuple type unichr unicode vars xrange zip
  58. endif
  59. if exists("python_highlight_exceptions")
  60. syn keyword pythonException ArithmeticError AssertionError AttributeError
  61. syn keyword pythonException BaseException BufferError BytesWarning
  62. syn keyword pythonException DeprecationWarning EOFError EnvironmentError
  63. syn keyword pythonException Exception FloatingPointError FutureWarning
  64. syn keyword pythonException GeneratorExit IOError ImportError ImportWarning
  65. syn keyword pythonException IndentationError IndexError KeyError
  66. syn keyword pythonException KeyboardInterrupt LookupError MemoryError
  67. syn keyword pythonException NameError NotImplementedError OSError
  68. syn keyword pythonException OverflowError PendingDeprecationWarning
  69. syn keyword pythonException ReferenceError RuntimeError RuntimeWarning
  70. syn keyword pythonException StandardError StopIteration SyntaxError
  71. syn keyword pythonException SyntaxWarning SystemError SystemExit TabError
  72. syn keyword pythonException TypeError UnboundLocalError UnicodeDecodeError
  73. syn keyword pythonException UnicodeEncodeError UnicodeError
  74. syn keyword pythonException UnicodeTranslateError UnicodeWarning
  75. syn keyword pythonException UserWarning ValueError Warning
  76. syn keyword pythonException ZeroDivisionError
  77. endif
  78. if exists("python_highlight_space_errors")
  79. syn match pythonSpaceError display excludenl "\S\s\+$"ms=s+1
  80. syn match pythonSpaceError display " \+\t"
  81. syn match pythonSpaceError display "\t\+ "
  82. endif
  83. hi def link pythonStatement Statement
  84. hi def link pythonStatement Statement
  85. hi def link pythonFunction Function
  86. hi def link pythonRepeat Repeat
  87. hi def link pythonConditional Conditional
  88. hi def link pythonOperator Operator
  89. hi def link pythonPreCondit PreCondit
  90. hi def link pythonComment Comment
  91. hi def link pythonTodo Todo
  92. hi def link pythonString String
  93. hi def link pythonEscape Special
  94. hi def link pythonEscape Special
  95. if exists("python_highlight_numbers")
  96. hi def link pythonNumber Number
  97. endif
  98. if exists("python_highlight_builtins")
  99. hi def link pythonBuiltin Function
  100. endif
  101. if exists("python_highlight_exceptions")
  102. hi def link pythonException Exception
  103. endif
  104. if exists("python_highlight_space_errors")
  105. hi def link pythonSpaceError Error
  106. endif
  107. " Uncomment the 'minlines' statement line and comment out the 'maxlines'
  108. " statement line; changes behaviour to look at least 2000 lines previously for
  109. " syntax matches instead of at most 200 lines
  110. syn sync match pythonSync grouphere NONE "):$"
  111. syn sync maxlines=200
  112. "syn sync minlines=2000
  113. let b:current_syntax = "python"