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