Browse Source

Highlight `self` and `cls` as identifiers

Pedro Algarvio 10 years ago
parent
commit
80a803b98d
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      syntax/python.vim

+ 10
- 0
syntax/python.vim View File

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