Skip to content

Commit a6f33ab

Browse files
committed
Fix syntax file
1 parent bd6caec commit a6f33ab

File tree

1 file changed

+82
-6
lines changed

1 file changed

+82
-6
lines changed

syntax/python.vim

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
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+
""
179
" Vim syntax file
280
"
381
" Modification:
@@ -79,14 +157,12 @@
79157
" For "print" builtin as function:
80158
" python_print_as_function
81159

82-
" DESC: Disable script loading
83-
if !pymode#Option('syntax') || pymode#Default('b:current_syntax', 'python')
84-
finish
85-
endif
86-
87160
" For version 5.x: Clear all syntax items
161+
" For version 6.x: Quit when a syntax file was already loaded
88162
if version < 600
89-
syntax clear
163+
syntax clear
164+
elseif exists("b:current_syntax")
165+
finish
90166
endif
91167

92168
if exists("python_highlight_all") && python_highlight_all != 0

0 commit comments

Comments
 (0)