From 66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Feb 2023 09:34:27 +0100 Subject: vim-patch:partial:dd60c365cd26 (#22437) vim-patch:partial:dd60c365cd26 Update runtime files https://github.com/vim/vim/commit/dd60c365cd2630794be84d63c4fe287124a30b97 Co-authored-by: Bram Moolenaar Skip: eval.txt, repeat.txt (needs `getscriptinfo()`) --- runtime/syntax/python.vim | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'runtime/syntax/python.vim') diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index ef4da1b448..831fb92f4c 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2022 Jun 28 +" Last Change: 2023 Feb 26 " Credits: Neil Schemenauer " Dmitry Vasiliev " @@ -35,12 +35,26 @@ " " let python_highlight_all = 1 " +" The use of Python 2 compatible syntax highlighting can be enforced. +" The straddling code (Python 2 and 3 compatible), up to Python 3.5, +" will be also supported. +" +" let python_use_python2_syntax = 1 +" +" This option will exclude all modern Python 3.6 or higher features. +" " quit when a syntax file was already loaded. if exists("b:current_syntax") finish endif +" Use of Python 2 and 3.5 or lower requested. +if exists("python_use_python2_syntax") + runtime! syntax/python2.vim + finish +endif + " We need nocompatible mode in order to continue lines with backslashes. " Original setting will be restored. let s:cpo_save = &cpo @@ -91,8 +105,8 @@ syn keyword pythonInclude from import syn keyword pythonAsync async await " Soft keywords -" These keywords do not mean anything unless used in the right context -" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords +" These keywords do not mean anything unless used in the right context. +" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords " for more on this. syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" -- cgit From e3f36377c156749bbdafc46d8a8cd017f378b4b5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 23 Apr 2023 15:22:55 +0200 Subject: vim-patch:71badf9547e8 (#23285) Update runtime files https://github.com/vim/vim/commit/71badf9547e8f89571b9a095183671cbb333d528 Co-authored-by: Bram Moolenaar --- runtime/syntax/python.vim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'runtime/syntax/python.vim') diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 831fb92f4c..043ea6d19b 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2023 Feb 26 +" Last Change: 2023 Feb 28 " Credits: Neil Schemenauer " Dmitry Vasiliev " @@ -178,17 +178,17 @@ syn match pythonEscape "\\$" " and so on, as specified in the 'Python Language Reference'. " https://docs.python.org/reference/lexical_analysis.html#numeric-literals if !exists("python_no_number_highlight") - " numbers (including longs and complex) - syn match pythonNumber "\<0[oO]\=\o\+[Ll]\=\>" - syn match pythonNumber "\<0[xX]\x\+[Ll]\=\>" - syn match pythonNumber "\<0[bB][01]\+[Ll]\=\>" - syn match pythonNumber "\<\%([1-9]\d*\|0\)[Ll]\=\>" - syn match pythonNumber "\<\d\+[jJ]\>" - syn match pythonNumber "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" + " numbers (including complex) + syn match pythonNumber "\<0[oO]\%(_\=\o\)\+\>" + syn match pythonNumber "\<0[xX]\%(_\=\x\)\+\>" + syn match pythonNumber "\<0[bB]\%(_\=[01]\)\+\>" + syn match pythonNumber "\<\%([1-9]\%(_\=\d\)*\|0\+\%(_\=0\)*\)\>" + syn match pythonNumber "\<\d\%(_\=\d\)*[jJ]\>" + syn match pythonNumber "\<\d\%(_\=\d\)*[eE][+-]\=\d\%(_\=\d\)*[jJ]\=\>" syn match pythonNumber - \ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@=" + \ "\<\d\%(_\=\d\)*\.\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\%(\W\|$\)\@=" syn match pythonNumber - \ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" + \ "\%(^\|\W\)\zs\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\>" endif " Group the built-ins in the order in the 'Python Library Reference' for -- cgit