Skip to content

Commit 83d4c63

Browse files
koka831nfnty
authored andcommitted
Implement python class name highlighting
Fixes #18 Closes #30
1 parent 0ad21fd commit 83d4c63

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

syntax/python.vim

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ endif
7474

7575
syn keyword pythonStatement break continue del return pass yield global assert lambda with
7676
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
77-
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
77+
syn keyword pythonStatement def nextgroup=pythonFunction skipwhite
78+
syn keyword pythonStatement class nextgroup=pythonClass skipwhite
7879
if s:Enabled('g:python_highlight_class_vars')
7980
syn keyword pythonClassVar self cls mcs
8081
endif
@@ -100,6 +101,7 @@ else
100101
syn keyword pythonStatement as nonlocal
101102
syn match pythonStatement '\v\.@<!<await>'
102103
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
104+
syn match pythonClass '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
103105
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
104106
syn match pythonStatement '\<async\s\+with\>'
105107
syn match pythonStatement '\<async\s\+for\>'
@@ -499,6 +501,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
499501
HiLink pythonBuiltinType Structure
500502

501503
HiLink pythonExClass Structure
504+
HiLink pythonClass Structure
502505
HiLink pythonClassVar Identifier
503506

504507
delcommand HiLink

tests/test.py

+4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ def functionname
2626
test.functionname()
2727
test.functionname ()
2828
class Classname
29+
class classname
30+
class classname_cls
2931
def функция
3032
функция()
3133
class Класс
34+
class класс
35+
3236

3337
# Keywords: Python 2
3438

0 commit comments

Comments
 (0)