Skip to content

Commit 988efe9

Browse files
Basic match support
See vim-python#80 (comment)
1 parent 2cc00ba commit 988efe9

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

match.patch

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/syntax/python.vim b/syntax/python.vim
2+
index 2524aba..3d49f51 100644
3+
--- a/syntax/python.vim
4+
+++ b/syntax/python.vim
5+
@@ -81,6 +81,7 @@ if s:Enabled('g:python_highlight_class_vars')
6+
endif
7+
syn keyword pythonRepeat for while
8+
syn keyword pythonConditional if elif else
9+
+syn keyword pythonMatch match case
10+
syn keyword pythonException try except finally
11+
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
12+
" we provide a dummy group here to avoid crashing pyrex.vim.
13+
@@ -105,7 +106,7 @@ else
14+
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
15+
syn match pythonStatement '\<async\s\+with\>'
16+
syn match pythonStatement '\<async\s\+for\>'
17+
- syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
18+
+ syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonMatch,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
19+
endif
20+
21+
22+
@@ -434,6 +435,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
23+
HiLink pythonFunction Function
24+
HiLink pythonFunctionCall Function
25+
HiLink pythonConditional Conditional
26+
+ HiLink pythonMatch Conditional
27+
HiLink pythonRepeat Repeat
28+
HiLink pythonException Exception
29+
HiLink pythonOperator Operator
30+

syntax/python.vim

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ if s:Enabled('g:python_highlight_class_vars')
8181
endif
8282
syn keyword pythonRepeat for while
8383
syn keyword pythonConditional if elif else
84+
syn keyword pythonMatch match case
8485
syn keyword pythonException try except finally
8586
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
8687
" we provide a dummy group here to avoid crashing pyrex.vim.
@@ -105,7 +106,7 @@ else
105106
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
106107
syn match pythonStatement '\<async\s\+with\>'
107108
syn match pythonStatement '\<async\s\+for\>'
108-
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
109+
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonMatch,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonFString,pythonRawString,pythonRawFString,pythonBytes,pythonBoolean,pythonNone,pythonSingleton,pythonBuiltinObj,pythonBuiltinFunc,pythonBuiltinType,pythonClassVar
109110
endif
110111

111112

@@ -434,6 +435,7 @@ if v:version >= 508 || !exists('did_python_syn_inits')
434435
HiLink pythonFunction Function
435436
HiLink pythonFunctionCall Function
436437
HiLink pythonConditional Conditional
438+
HiLink pythonMatch Conditional
437439
HiLink pythonRepeat Repeat
438440
HiLink pythonException Exception
439441
HiLink pythonOperator Operator

0 commit comments

Comments
 (0)