From e486a97ad8fb07d6d19e9db9e4a7184f168ec3c4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 28 Jun 2018 21:08:58 +1000 Subject: Fix highlighters in rc/core post syntax refactoring --- rc/core/python.kak | 65 ++++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 36 deletions(-) (limited to 'rc/core/python.kak') diff --git a/rc/core/python.kak b/rc/core/python.kak index 9551ba85..1dbf7c69 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -11,35 +11,28 @@ hook global BufCreate .*[.](py) %{ # Highlighters & Completion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/ regions -default code python \ - docstring '"""' '"""' '' \ - docstring "'''" "'''" '' \ - double_string '"' (?>> \K' '\z' '' \ - python '\.\.\. \K' '\z' '' -add-highlighter shared/python/docstring/py-docstring/python ref python -add-highlighter shared/python/docstring/py-docstring/docstring fill string - -add-highlighter shared/python/comment fill comment +add-highlighter shared/python/docstring/ default-region fill string +add-highlighter shared/python/docstring/ region '>>> \K' '\z' '' ref python +add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' '' ref python evaluate-commands %sh{ # Grammar @@ -108,20 +101,20 @@ evaluate-commands %sh{ # Highlight keywords printf %s " - add-highlighter shared/python/code regex '\b(${values})\b' 0:value - add-highlighter shared/python/code regex '\b(${meta})\b' 0:meta - add-highlighter shared/python/code regex '\b(${attribute})\b' 0:attribute - add-highlighter shared/python/code regex '\bdef\s+(${methods})\b' 1:function - add-highlighter shared/python/code regex '\b(${exceptions})\b' 0:function - add-highlighter shared/python/code regex '\b(${keywords})\b' 0:keyword - add-highlighter shared/python/code regex '\b(${functions})\b\(' 1:builtin - add-highlighter shared/python/code regex '\b(${types})\b' 0:type - add-highlighter shared/python/code regex '@[\w_]+\b' 0:attribute + add-highlighter shared/python/code/ regex '\b(${values})\b' 0:value + add-highlighter shared/python/code/ regex '\b(${meta})\b' 0:meta + add-highlighter shared/python/code/ regex '\b(${attribute})\b' 0:attribute + add-highlighter shared/python/code/ regex '\bdef\s+(${methods})\b' 1:function + add-highlighter shared/python/code/ regex '\b(${exceptions})\b' 0:function + add-highlighter shared/python/code/ regex '\b(${keywords})\b' 0:keyword + add-highlighter shared/python/code/ regex '\b(${functions})\b\(' 1:builtin + add-highlighter shared/python/code/ regex '\b(${types})\b' 0:type + add-highlighter shared/python/code/ regex '@[\w_]+\b' 0:attribute " } -add-highlighter shared/python/code regex (?<=[\w\s\d'"_])(<=|<<|>>|>=|<>|<|>|!=|==|\||\^|&|\+|-|\*\*|\*|//|/|%|~) 0:operator -add-highlighter shared/python/code regex (?<=[\w\s\d'"_])((?!])=(?![=])|[+*-]=) 0:builtin +add-highlighter shared/python/code/ regex (?<=[\w\s\d'"_])(<=|<<|>>|>=|<>|<|>|!=|==|\||\^|&|\+|-|\*\*|\*|//|/|%|~) 0:operator +add-highlighter shared/python/code/ regex (?<=[\w\s\d'"_])((?!])=(?![=])|[+*-]=) 0:builtin # Commands # ‾‾‾‾‾‾‾‾ @@ -142,7 +135,7 @@ define-command -hidden python-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group python-highlight global WinSetOption filetype=python %{ add-highlighter window ref python } +hook -group python-highlight global WinSetOption filetype=python %{ add-highlighter window/python ref python } hook global WinSetOption filetype=python %{ hook window InsertChar \n -group python-indent python-indent-on-new-line -- cgit v1.2.3