|
| 1 | +""if version < 600 |
| 2 | +"" syntax clear |
| 3 | +""elseif exists("b:current_syntax") |
| 4 | +"" finish |
| 5 | +""endif |
| 6 | +"" |
| 7 | +""let s:cpo_save = &cpo |
| 8 | +""set cpo&vim |
| 9 | +"" |
| 10 | +""syn match pythonAssignment "+=\|-=\|\*=\|/=\|//=\|%=\|&=\||=\|\^=\|>>=\|<<=\|**=" |
| 11 | +""syn match pythonAssignment "=" |
| 12 | +""syn match pythonArithmetic "+\|-\|*\|**\|/\|//\|%\|<<\|>>\|&\||\|\^\|\~" |
| 13 | +""syn match pythonComparison "<\|>\|<=\|>=\|==\|!=\|<>" |
| 14 | +"" |
| 15 | +""syn region pythonDocstring |
| 16 | +"" \ start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl |
| 17 | +"" \ contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError |
| 18 | +""syn region pythonDocstring |
| 19 | +"" \ start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl |
| 20 | +"" \ contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError |
| 21 | +"" |
| 22 | +""syn region pythonCallName |
| 23 | +"" \ start="[a-zA-Z_][a-zA-Z0-9_]*(" end=")" fold |
| 24 | +"" \ contains=pythonCall keepend extend |
| 25 | +""syn region pythonCall |
| 26 | +"" \ start="("ms=s+1 end=")$"me=e-1 contained |
| 27 | +"" \ contains=pythonCallArgs,@pythonExpression |
| 28 | +"" \ containedin=pythonFunction |
| 29 | +""syn match pythonCallArgs "[^,]" contained |
| 30 | +"" \ contains=pythonCallKeyword,pythonCallName,@pythonExpression skipwhite |
| 31 | +""syn match pythonCallKeyword |
| 32 | +"" \ "[a-zA-Z_][a-zA-Z0-9_]\+\s*=[^=]\{1\}"me=e-1 display contained |
| 33 | +"" \ contains=pythonKeyAssign skipwhite |
| 34 | +""syn match pythonKeyAssign "=" display contained |
| 35 | +"" |
| 36 | +""syn match pythonDot "\." display containedin=pythonFunction |
| 37 | +"" |
| 38 | +"" |
| 39 | +""syn keyword pythonBuiltinFunc __import__ abs all any apply basestring bin |
| 40 | +"" \ bool buffer bytearray bytes callable chr classmethod cmp coerce compile |
| 41 | +"" \ complex delattr dict dir divmod enumerate eval execfile file filter |
| 42 | +"" \ float format frozenset getattr globals hasattr hash help hex id input |
| 43 | +"" \ int intern isinstance issubclass iter len list locals long map max min |
| 44 | +"" \ next object oct open ord pow property range raw_input reduce reload repr |
| 45 | +"" \ reversed round set setattr slice sorted staticmethod str sum super tuple |
| 46 | +"" \ type unichr unicode vars xrange zip |
| 47 | +""syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented __debug__ |
| 48 | +"" \ __doc__ __file__ __name__ __package__ |
| 49 | +"" |
| 50 | +"" |
| 51 | +""syn cluster pythonExpression |
| 52 | +"" \ contains=pythonComparison,pythonOperator,pythonDot,@pythonStringType, |
| 53 | +"" \@pythonNumberType,@pythonBuiltin,pythonFuncCall |
| 54 | +""syn cluster pythonStringType |
| 55 | +"" \ contains=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
| 56 | +""syn cluster pythonNumberType contains=pythonNumber,pythonHexNumber,pythonFloat |
| 57 | +"" |
| 58 | +"" |
| 59 | +""hi link pythonOperator Operator |
| 60 | +""hi link pythonAssignment Operator |
| 61 | +""hi link pythonArithmetic Operator |
| 62 | +""hi link pythonComparison Operator |
| 63 | +""hi link pythonDocstring Comment |
| 64 | +""hi link pythonInclude PreCondit |
| 65 | +"" |
| 66 | +""hi link pythonBuiltinFunc Function |
| 67 | +""hi link pythonBuiltinObj Structure |
| 68 | +"" |
| 69 | +""hi link pythonDot Comment |
| 70 | +""hi link pythonCallKeyword Identifier |
| 71 | +""hi link pythonKeyAssign Operator |
| 72 | +"" |
| 73 | +"" |
| 74 | +""let &cpo = s:cpo_save |
| 75 | +""unlet s:cpo_save |
| 76 | +"" |
| 77 | +"" |
| 78 | +"" |
1 | 79 | " Vim syntax file
|
2 | 80 | "
|
3 | 81 | " Modification:
|
|
79 | 157 | " For "print" builtin as function:
|
80 | 158 | " python_print_as_function
|
81 | 159 |
|
82 |
| -" DESC: Disable script loading |
83 |
| -if !pymode#Option('syntax') || pymode#Default('b:current_syntax', 'python') |
84 |
| - finish |
85 |
| -endif |
86 |
| - |
87 | 160 | " For version 5.x: Clear all syntax items
|
| 161 | +" For version 6.x: Quit when a syntax file was already loaded |
88 | 162 | if version < 600
|
89 |
| - syntax clear |
| 163 | + syntax clear |
| 164 | +elseif exists("b:current_syntax") |
| 165 | + finish |
90 | 166 | endif
|
91 | 167 |
|
92 | 168 | if exists("python_highlight_all") && python_highlight_all != 0
|
|
0 commit comments