From ebcb47e0969671513b40ed0a1d092cf208599720 Mon Sep 17 00:00:00 2001 From: LXNN Date: Sun, 24 Oct 2021 12:56:18 +0100 Subject: [PATCH] Add new '_', 'case', and 'match' keywords to Python highlighter --- rc/filetype/python.kak | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 7f0e83d8..d05338d3 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -106,6 +106,9 @@ evaluate-commands %sh{ finally for global if in is lambda nonlocal not or pass print raise return try while with yield" + # Collected from `keyword.softkwlist` + soft_keywords="_ case match" + types="bool buffer bytearray bytes complex dict file float frozenset int list long memoryview object set str tuple unicode xrange" @@ -129,7 +132,7 @@ evaluate-commands %sh{ add-highlighter shared/python/code/ regex '\b($(join "${attributes}" '|'))\b' 0:attribute add-highlighter shared/python/code/ regex '\bdef\s+($(join "${methods}" '|'))\b' 1:function add-highlighter shared/python/code/ regex '\b($(join "${exceptions}" '|'))\b' 0:function - add-highlighter shared/python/code/ regex '\b($(join "${keywords}" '|'))\b' 0:keyword + add-highlighter shared/python/code/ regex '\b($(join "${keywords} ${soft_keywords}" '|'))\b' 0:keyword add-highlighter shared/python/code/ regex '\b($(join "${functions}" '|'))\b\(' 1:builtin add-highlighter shared/python/code/ regex '\b($(join "${types}" '|'))\b' 0:type add-highlighter shared/python/code/ regex '^\h*(@[\w_.]+))' 1:attribute