Bläddra i källkod

Highlight `self` and `cls` as identifiers

Pedro Algarvio 10 år sedan
förälder
incheckning
80a803b98d
1 ändrade filer med 10 tillägg och 0 borttagningar
  1. 10
    0
      syntax/python.vim

+ 10
- 0
syntax/python.vim Visa fil

@@ -26,6 +26,7 @@
26 26
 " Optional highlighting can be controlled using these variables.
27 27
 "
28 28
 "   let python_no_builtin_highlight = 1
29
+"   let python_no_self_highlight = 1
29 30
 "   let python_no_doctest_code_highlight = 1
30 31
 "   let python_no_doctest_highlight = 1
31 32
 "   let python_no_exception_highlight = 1
@@ -59,6 +60,9 @@ if exists("python_highlight_all")
59 60
   if exists("python_no_builtin_highlight")
60 61
     unlet python_no_builtin_highlight
61 62
   endif
63
+  if exists("python_no_self_highlight")
64
+    unlet python_no_self_highlight
65
+  endif
62 66
   if exists("python_no_doctest_code_highlight")
63 67
     unlet python_no_doctest_code_highlight
64 68
   endif
@@ -115,6 +119,9 @@ syn keyword pythonRepeat	for while
115 119
 syn keyword pythonOperator	and in is not or
116 120
 syn keyword pythonException	except finally raise try
117 121
 syn keyword pythonInclude	from import
122
+if !exists("python_no_self_highlight")
123
+  syn keyword pythonSelf	self cls
124
+endif
118 125
 
119 126
 " Decorators (new in Python 2.4)
120 127
 syn match   pythonDecorator	"@" display nextgroup=pythonFunction skipwhite
@@ -342,6 +349,9 @@ if version >= 508 || !exists("did_python_syn_inits")
342 349
   if !exists("python_no_builtin_highlight")
343 350
     HiLink pythonBuiltin	Function
344 351
   endif
352
+  if !exists("python_no_self_highlight")
353
+    HiLink pythonSelf		Identifier
354
+  endif
345 355
   if !exists("python_no_exception_highlight")
346 356
     HiLink pythonExceptions	Structure
347 357
   endif