diff options
Diffstat (limited to 'runtime/syntax/python.vim')
-rw-r--r-- | runtime/syntax/python.vim | 20 |
1 files changed, 17 insertions, 3 deletions
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 <zpetkovic@acm.org> -" Last Change: 2022 Jun 28 +" Last Change: 2023 Feb 26 " Credits: Neil Schemenauer <nas@python.ca> " 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*\%(#.*\)\=$\)\@=" |