Browse Source

A bunch of operator highlights

Pedro Algarvio 9 years ago
parent
commit
f12e6e9bba
1 changed files with 29 additions and 0 deletions
  1. 29
    0
      syntax/python.vim

+ 29
- 0
syntax/python.vim View File

@@ -34,6 +34,9 @@
34 34
 "   let python_no_string_format_highlight = 1
35 35
 "   let python_no_string_formatting_highlight = 1
36 36
 "   let python_no_string_template_highlight = 1
37
+"   let python_no_extra_operators_highlight = 1
38
+"   let python_no_stars_operators_highlight = 1
39
+"   let python_no_equal_sign_operator_highlight = 1
37 40
 "   let python_space_error_highlight = 1
38 41
 "   let python_shebang_header_highlight = 1
39 42
 "   let python_coding_header_highlight = 1
@@ -84,6 +87,15 @@ if exists("python_highlight_all")
84 87
   if exists("python_no_string_template_highlight")
85 88
     unlet python_no_string_template_highlight
86 89
   endif
90
+  if exists("python_no_extra_operators_highlight")
91
+    unlet python_no_extra_operators_highlight
92
+  endif
93
+  if exists("python_no_stars_operators_highlight")
94
+    unlet python_no_stars_operators_highlight
95
+  endif
96
+  if exists("python_no_equal_sign_operator_highlight")
97
+    unlet python_no_equal_sign_operator_highlight
98
+  endif
87 99
   let python_space_error_highlight = 1
88 100
   let python_shebang_header_highlight = 1
89 101
   let python_coding_header_highlight = 1
@@ -123,6 +135,19 @@ if !exists("python_no_self_highlight")
123 135
   syn keyword pythonSelf	self cls
124 136
 endif
125 137
 
138
+if !exists("python_no_extra_operators_highlight")
139
+  syn match pythonExtraOperator "\%([~!^&|/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\.\.\.\|\.\.\|::\)"
140
+  syn match pythonExtraPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)"
141
+endif
142
+
143
+if !exists("python_no_stars_operators_highlight")
144
+  syn match pythonExtraOperator "\%(\*\|\*\*\)"
145
+endif
146
+
147
+if !exists("python_no_equal_sign_operator_highlight")
148
+  syn match pythonExtraOperator "\%(=\)"
149
+endif
150
+
126 151
 " Decorators (new in Python 2.4)
127 152
 syn match   pythonDecorator	"@" display nextgroup=pythonFunction skipwhite
128 153
 " The zero-length non-grouping match before the function name is
@@ -319,6 +344,10 @@ if version >= 508 || !exists("did_python_syn_inits")
319 344
   HiLink pythonConditional	Conditional
320 345
   HiLink pythonRepeat		Repeat
321 346
   HiLink pythonOperator		Operator
347
+  if !exists("python_no_extra_operators_highlight")
348
+    HiLink pythonExtraOperator		Operator
349
+    HiLink pythonExtraPseudoOperator	Operator
350
+  endif
322 351
   HiLink pythonException	Exception
323 352
   HiLink pythonInclude		Include
324 353
   HiLink pythonDecorator	Define