Implement python class name highlighting

Fixes #18
Closes #30
This commit is contained in:
koka
2017-07-08 22:52:22 +09:00
committed by nfnty
parent 0ad21fd728
commit 83d4c63f77
2 changed files with 8 additions and 1 deletions

View File

@@ -74,7 +74,8 @@ endif
syn keyword pythonStatement break continue del return pass yield global assert lambda with syn keyword pythonStatement break continue del return pass yield global assert lambda with
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite syn keyword pythonStatement def nextgroup=pythonFunction skipwhite
syn keyword pythonStatement class nextgroup=pythonClass skipwhite
if s:Enabled('g:python_highlight_class_vars') if s:Enabled('g:python_highlight_class_vars')
syn keyword pythonClassVar self cls mcs syn keyword pythonClassVar self cls mcs
endif endif
@@ -100,6 +101,7 @@ else
syn keyword pythonStatement as nonlocal syn keyword pythonStatement as nonlocal
syn match pythonStatement '\v\.@<!<await>' syn match pythonStatement '\v\.@<!<await>'
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
syn match pythonClass '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>' syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>' syn match pythonStatement '\<async\s\+for\>'
@@ -499,6 +501,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
HiLink pythonBuiltinType Structure HiLink pythonBuiltinType Structure
HiLink pythonExClass Structure HiLink pythonExClass Structure
HiLink pythonClass Structure
HiLink pythonClassVar Identifier HiLink pythonClassVar Identifier
delcommand HiLink delcommand HiLink

View File

@@ -26,9 +26,13 @@ functionname ()
test.functionname() test.functionname()
test.functionname () test.functionname ()
class Classname class Classname
class classname
class classname_cls
def функция def функция
функция() функция()
class Класс class Класс
class класс
# Keywords: Python 2 # Keywords: Python 2