runtime(python): highlight bytes in python Commit: https://github.com/vim/vim/commit/a24f5be86d895981cb84266f98bae9f14407264b Author: Rob B <git...@0x7e.net> Date: Mon Jul 14 22:30:59 2025 +0200
runtime(python): highlight bytes in python - Highlight bytes literals - Do not highlight Unicode escape sequences in bytes literals fixes: #14033 fixes: #17726 closes: #17728 Signed-off-by: Rob B <git...@0x7e.net> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 68036f590..759af2d4f 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetko...@acm.org> -" Last Change: 2023 Feb 28 +" Last Change: 2025 Jul 14 " Credits: Neil Schemenauer <n...@python.ca> " Dmitry Vasiliev +" Rob B " " This version is a major rewrite by Zvezdan Petkovic. " @@ -144,24 +145,48 @@ syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained " Triple-quoted strings can contain doctests. syn region pythonString matchgroup=pythonQuotes \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\|\\z1" - \ contains=pythonEscape,@Spell + \ contains=pythonEscape,pythonUnicodeEscape,@Spell syn region pythonString matchgroup=pythonTripleQuotes \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend - \ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell + \ contains=pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell syn region pythonRawString matchgroup=pythonQuotes - \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\|\\z1" + \ start=+[rR]\z(['"]\)+ end="\z1" skip="\\\|\\z1" \ contains=@Spell syn region pythonRawString matchgroup=pythonTripleQuotes - \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend + \ start=+[rR]\z('''\|"""\)+ end="\z1" keepend \ contains=pythonSpaceError,pythonDoctest,@Spell +" Bytes +syn region pythonBytes + \ matchgroup=pythonQuotes + \ start=+ -- -- 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/E1ubQ2o-005nrX-Uo%40256bit.org.