runtime(python): highlight "self" and "cls" in syntax script
Commit: https://github.com/vim/vim/commit/1ee1d9b43da37b157a91662a312415e4db400ba9 Author: Jon Parise <j...@indelible.org> Date: Wed Aug 13 22:34:51 2025 +0200 runtime(python): highlight "self" and "cls" in syntax script These are special names by convention, and giving them distinct highlighting is a nice visual clue (using Identifier by default). This group is named "pythonClassVar" to match the name used by python-syntax. Some third-party color schemes are aware of this name and customized their colors accordingly. closes: #17968 Signed-off-by: Jon Parise <j...@indelible.org> Signed-off-by: Zvezdan Petkovic <zpetko...@acm.org> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index cc62babbf..5c437b511 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetko...@acm.org> -" Last Change: 2025 Aug 11 +" Last Change: 2025 Aug 13 " Credits: Neil Schemenauer <n...@python.ca> " Dmitry Vasiliev " Rob B @@ -113,6 +113,10 @@ syn keyword pythonAsync async await syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" +" These names are special by convention. While they aren't real keywords, +" giving them distinct highlighting provides a nice visual cue. +syn keyword pythonClassVar self cls + " Decorators " A dot must be allowed because of @MyClass.myfunc decorators. syn match pythonDecorator "@" display contained @@ -378,6 +382,7 @@ hi def link pythonOperator Operator hi def link pythonException Exception hi def link pythonInclude Include hi def link pythonAsync Statement +hi def link pythonClassVar Identifier hi def link pythonDecorator Define hi def link pythonDecoratorName Function hi def link pythonClass Structure -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1umILI-00D7fq-Oy%40256bit.org.