diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2016-11-11 16:07:45 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2016-11-24 17:06:45 +0300 |
| commit | 94971e0e8abd419c35d0dd0784f7909d21ee01f9 (patch) | |
| tree | 075fbfa378b00a4049ee2898d2322a1274b25682 /rc/core/python.kak | |
| parent | e340e0ed396609aca7569903d6963aa36acbe5d7 (diff) | |
Introduce the `builtin` face, modify scripts accordingly
Diffstat (limited to 'rc/core/python.kak')
| -rw-r--r-- | rc/core/python.kak | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/rc/core/python.kak b/rc/core/python.kak index 42d9d449..7bca05b7 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -31,12 +31,22 @@ addhl -group /python/comment fill comment values="True|False|None" meta="import|from" # Keyword list is collected using `keyword.kwlist` from `keyword` - keywords="and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|global|if|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield" - types="bool|buffer|bytearray|complex|dict|file|float|frozenset|int|list|long|memoryview|object|set|str|tuple|unicode|xrange" + keywords="and|as|assert|break|class|continue|def|del|elif|else|except|exec" + keywords="${keywords}|finally|for|global|if|in|is|lambda|not|or|pass|print" + keywords="${keywords}|raise|return|try|while|with|yield" + types="bool|buffer|bytearray|bytes|complex|dict|file|float|frozenset|int" + types="${types}|list|long|memoryview|object|set|str|tuple|unicode|xrange" + functions="abs|all|any|ascii|bin|callable|chr|classmethod|compile|complex" + functions="${functions}|delattr|dict|dir|divmod|enumerate|eval|exec|filter" + functions="${functions}|format|frozenset|getattr|globals|hasattr|hash|help" + functions="${functions}|hex|id|__import__|input|isinstance|issubclass|iter" + functions="${functions}|len|locals|map|max|memoryview|min|next|oct|open|ord" + functions="${functions}|pow|print|property|range|repr|reversed|round" + functions="${functions}|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip" # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=python %{ - set window static_words '${values}:${meta}:${keywords}:${types}' + set window static_words '${values}:${meta}:${keywords}:${types}:${functions}' }" | sed 's,|,:,g' # Highlight keywords @@ -44,10 +54,14 @@ addhl -group /python/comment fill comment addhl -group /python/code regex '\b(${values})\b' 0:value addhl -group /python/code regex '\b(${meta})\b' 0:meta addhl -group /python/code regex '\b(${keywords})\b' 0:keyword + addhl -group /python/code regex '\b(${functions})\b\(' 1:builtin " - # Highlight types, when they are not used as constructors - printf %s "addhl -group /python/code regex '\b(${types})\b[^(]' 1:type" + # Highlight types and attributes + printf %s " + addhl -group /python/code regex '\b(${types})\b' 0:type + addhl -group /python/code regex '@[\w_]+\b' 0:attribute + " } # Commands |
