|
37 | 37 | " For highlight string formatting: |
38 | 38 | " python_highlight_string_formatting |
39 | 39 | " |
40 | | -" For highlight string.Template templates: |
| 40 | +" For highlight str.format syntax: |
| 41 | +" python_highlight_string_format |
| 42 | +" |
| 43 | +" For highlight string.Template syntax: |
41 | 44 | " python_highlight_string_templates |
42 | 45 | " |
43 | 46 | " For highlight indentation errors: |
@@ -78,6 +81,9 @@ if exists("python_highlight_all") && python_highlight_all != 0 |
78 | 81 | if !exists("python_highlight_string_formatting") |
79 | 82 | let python_highlight_string_formatting = 1 |
80 | 83 | endif |
| 84 | + if !exists("python_highlight_string_format") |
| 85 | + let python_highlight_string_format = 1 |
| 86 | + endif |
81 | 87 | if !exists("python_highlight_string_templates") |
82 | 88 | let python_highlight_string_templates = 1 |
83 | 89 | endif |
@@ -182,8 +188,13 @@ syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display |
182 | 188 |
|
183 | 189 | if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0 |
184 | 190 | " String formatting |
185 | | - syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
186 | | - syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
| 191 | + syn match pythonStrFormatting "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
| 192 | + syn match pythonStrFormatting "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
| 193 | +endif |
| 194 | + |
| 195 | +if exists("python_highlight_string_format") && python_highlight_string_format != 0 |
| 196 | + " str.format syntax |
| 197 | + syn match pythonStrFormat "{\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)\(\.[a-zA-Z_][a-zA-Z0-9_]*\|\[\(\d\+\|[^!:\}]\+\)\]\)*\(![rs]\)\=\(:\({\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)}\|\([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString |
187 | 198 | endif |
188 | 199 |
|
189 | 200 | if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 |
@@ -311,8 +322,9 @@ if version >= 508 || !exists("did_python_syn_inits") |
311 | 322 | HiLink pythonUniRawEscape Special |
312 | 323 | HiLink pythonUniRawEscapeError Error |
313 | 324 |
|
314 | | - HiLink pythonStrFormat Special |
315 | | - HiLink pythonStrTemplate Special |
| 325 | + HiLink pythonStrFormatting Special |
| 326 | + HiLink pythonStrFormat Special |
| 327 | + HiLink pythonStrTemplate Special |
316 | 328 |
|
317 | 329 | HiLink pythonDocTest Special |
318 | 330 | HiLink pythonDocTest2 Special |
|
0 commit comments