diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-06-28 21:08:58 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-07-05 07:54:28 +1000 |
| commit | e486a97ad8fb07d6d19e9db9e4a7184f168ec3c4 (patch) | |
| tree | c572ea7f26e13e4b988795ddb53ae530af3d9227 /rc/core/python.kak | |
| parent | 7976f8289ea48d76cf1bb52ef75305b49510ec29 (diff) | |
Fix highlighters in rc/core post syntax refactoring
Diffstat (limited to 'rc/core/python.kak')
| -rw-r--r-- | rc/core/python.kak | 65 |
1 files changed, 29 insertions, 36 deletions
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 '"' (?<!\\)(\\\\)*" '' \ - single_string "'" (?<!\\)(\\\\)*' '' \ - comment '#' '$' '' +add-highlighter shared/python regions +add-highlighter shared/python/code default-region group +add-highlighter shared/python/docstring region -match-capture ("""|''') ("""|''') '' regions +add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" '' fill string +add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' '' fill string +add-highlighter shared/python/comment region '#' '$' '' fill comment # Integer formats -add-highlighter shared/python/code regex '(?i)\b0b[01]+l?\b' 0:value -add-highlighter shared/python/code regex '(?i)\b0x[\da-f]+l?\b' 0:value -add-highlighter shared/python/code regex '(?i)\b0o?[0-7]+l?\b' 0:value -add-highlighter shared/python/code regex '(?i)\b([1-9]\d*|0)l?\b' 0:value +add-highlighter shared/python/code/ regex '(?i)\b0b[01]+l?\b' 0:value +add-highlighter shared/python/code/ regex '(?i)\b0x[\da-f]+l?\b' 0:value +add-highlighter shared/python/code/ regex '(?i)\b0o?[0-7]+l?\b' 0:value +add-highlighter shared/python/code/ regex '(?i)\b([1-9]\d*|0)l?\b' 0:value # Float formats -add-highlighter shared/python/code regex '\b\d+[eE][+-]?\d+\b' 0:value -add-highlighter shared/python/code regex '(\b\d+)?\.\d+\b' 0:value -add-highlighter shared/python/code regex '\b\d+\.' 0:value +add-highlighter shared/python/code/ regex '\b\d+[eE][+-]?\d+\b' 0:value +add-highlighter shared/python/code/ regex '(\b\d+)?\.\d+\b' 0:value +add-highlighter shared/python/code/ regex '\b\d+\.' 0:value # Imaginary formats -add-highlighter shared/python/code regex '\b\d+\+\d+[jJ]\b' 0:value +add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value -add-highlighter shared/python/double_string fill string -add-highlighter shared/python/single_string fill string - -add-highlighter shared/python/docstring/ regions -default docstring py-docstring \ - python '>>> \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 |
