" Language: Python
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
" URL: http://www.hlabs.spb.ru/vim/python.vim
-" Last Change: 2008-09-29
+" Last Change: 2010-04-09
" Filenames: *.py
-" Version: 2.6.3
+" Version: 2.6.6
"
" Based on python.vim (from Vim 6.1 distribution)
" by Neil Schemenauer <nas@python.ca>
" (strings and comments)
" John Eikenberry
" for the patch fixing small typo
+" Caleb Adamantine
+" for the patch fixing highlighting for decorators
+" Andrea Riciputi
+" for the patch with new configuration options
"
" Options:
"
" Option names:
"
-" For highlight builtin functions:
+" For highlight builtin functions and objects:
" python_highlight_builtins
"
+" For highlight builtin objects:
+" python_highlight_builtin_objs
+"
+" For highlight builtin funtions:
+" python_highlight_builtin_funcs
+"
" For highlight standard exceptions:
" python_highlight_exceptions
"
if exists("python_highlight_all") && python_highlight_all != 0
" Not override previously set options
if !exists("python_highlight_builtins")
- let python_highlight_builtins = 1
+ if !exists("python_highlight_builtin_objs")
+ let python_highlight_builtin_objs = 1
+ endif
+ if !exists("python_highlight_builtin_funcs")
+ let python_highlight_builtin_funcs = 1
+ endif
endif
if !exists("python_highlight_exceptions")
let python_highlight_exceptions = 1
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
-syn keyword pythonImport import from as
+syn keyword pythonPreCondit import from as
syn keyword pythonException try except finally
syn keyword pythonOperator and in is not or
endif
" Decorators (new in Python 2.4)
-syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
+syn match pythonDecorator "@" display nextgroup=pythonDottedName skipwhite
+syn match pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
+syn match pythonDot "\." display containedin=pythonDottedName
" Comments
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display
-if exists("python_highlight_builtins") && python_highlight_builtins != 0
- " Builtin functions, types and objects
+if exists("python_highlight_builtin_objs") && python_highlight_builtin_objs != 0
+ " Builtin objects and types
syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
+endif
+if exists("python_highlight_builtin_funcs") && python_highlight_builtin_funcs != 0
+ " Builtin functions
syn keyword pythonBuiltinFunc __import__ abs all any apply
syn keyword pythonBuiltinFunc basestring bin bool buffer bytearray bytes callable
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
syn keyword pythonBuiltinFunc execfile file filter float format frozenset getattr
- syn keyword pythonBuiltinFunc globals hasattr hash help hex id
+ syn keyword pythonBuiltinFunc globals hasattr hash help hex id
syn keyword pythonBuiltinFunc input int intern isinstance
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
syn keyword pythonBuiltinFunc min next object oct open ord
endif
HiLink pythonStatement Statement
- HiLink pythonImport Statement
+ HiLink pythonPreCondit Statement
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonOperator Operator
HiLink pythonDecorator Define
+ HiLink pythonDottedName Function
+ HiLink pythonDot Normal
HiLink pythonComment Comment
HiLink pythonCoding Special