mirror of
https://github.com/vim-python/python-syntax.git
synced 2025-12-08 21:54:48 +08:00
Added support for string.Template syntax
This commit is contained in:
@@ -9,6 +9,8 @@ Revision 2.6.1 (unknown):
|
||||
- Added option "python_print_as_function" for highlight "print" as a
|
||||
function;
|
||||
- Added support for new integer literal syntax "0o" and "0b";
|
||||
- Added support for string.Template syntax controlled by
|
||||
"python_highlight_string_templates" option;
|
||||
|
||||
Revision 2.5.6 (2007-02-04):
|
||||
|
||||
|
||||
6
TODO.txt
6
TODO.txt
@@ -1,7 +1,11 @@
|
||||
- Highligh for string.Template?
|
||||
Now
|
||||
===
|
||||
|
||||
- Python 3.0 string formatting
|
||||
|
||||
Later
|
||||
=====
|
||||
|
||||
- Highligh errors where symbols follow by numbers like this: 0o123LaB
|
||||
|
||||
- Need more accurate way to handle indentation errors. For example
|
||||
|
||||
14
python.vim
14
python.vim
@@ -13,7 +13,7 @@
|
||||
" Thanks:
|
||||
"
|
||||
" Jeroen Ruigrok van der Werven
|
||||
" for the idea of highlighting for erroneous operators
|
||||
" for the idea to highlight erroneous operators
|
||||
" Pedro Algarvio
|
||||
" for the patch to enable spell checking only for the right spots
|
||||
" (strings and comments)
|
||||
@@ -37,6 +37,9 @@
|
||||
" For highlight string formatting:
|
||||
" python_highlight_string_formatting
|
||||
"
|
||||
" For highlight string.Template templates:
|
||||
" python_highlight_string_templates
|
||||
"
|
||||
" For highlight indentation errors:
|
||||
" python_highlight_indent_errors
|
||||
"
|
||||
@@ -75,6 +78,9 @@ if exists("python_highlight_all") && python_highlight_all != 0
|
||||
if !exists("python_highlight_string_formatting")
|
||||
let python_highlight_string_formatting = 1
|
||||
endif
|
||||
if !exists("python_highlight_string_templates")
|
||||
let python_highlight_string_templates = 1
|
||||
endif
|
||||
if !exists("python_highlight_indent_errors")
|
||||
let python_highlight_indent_errors = 1
|
||||
endif
|
||||
@@ -180,6 +186,11 @@ if exists("python_highlight_string_formatting") && python_highlight_string_forma
|
||||
syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
|
||||
endif
|
||||
|
||||
if exists("python_highlight_string_templates") && python_highlight_string_templates != 0
|
||||
" String templates
|
||||
syn match pythonStrTemplate "\$\(\$\|{[^}]*}\|[a-zA-Z_][a-zA-Z0-9_]*\)" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
|
||||
endif
|
||||
|
||||
if exists("python_highlight_doctests") && python_highlight_doctests != 0
|
||||
" DocTests
|
||||
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
|
||||
@@ -301,6 +312,7 @@ if version >= 508 || !exists("did_python_syn_inits")
|
||||
HiLink pythonUniRawEscapeError Error
|
||||
|
||||
HiLink pythonStrFormat Special
|
||||
HiLink pythonStrTemplate Special
|
||||
|
||||
HiLink pythonDocTest Special
|
||||
HiLink pythonDocTest2 Special
|
||||
|
||||
Reference in New Issue
Block a user