Commits

Pierre-Yves David  committed a5a01d9

Addi highlight of string formatting operator in python string.

  • Participants
  • Parent commits 4b2a108

Comments (0)

Files changed (1)

File syntax/python.vim

 syn match   pythonDecorator	"[a-zA-Z_][a-zA-Z0-9_]*" contained
 
 " strings
-syn region pythonString		matchgroup=Normal start=+[uU]\='+ end=+'+ skip=+\\\\\|\\'+ contains=pythonEscape
-syn region pythonString		matchgroup=Normal start=+[uU]\="+ end=+"+ skip=+\\\\\|\\"+ contains=pythonEscape
-syn region pythonString		matchgroup=Normal start=+[uU]\="""+ end=+"""+ contains=pythonEscape
-syn region pythonString		matchgroup=Normal start=+[uU]\='''+ end=+'''+ contains=pythonEscape
-syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]'+ end=+'+ skip=+\\\\\|\\'+
-syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]"+ end=+"+ skip=+\\\\\|\\"+
-syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]"""+ end=+"""+
-syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]'''+ end=+'''+
+syn region pythonString		matchgroup=Normal start=+[uU]\='+ end=+'+ skip=+\\\\\|\\'+ contains=pythonEscape,pythonStringFormat
+syn region pythonString		matchgroup=Normal start=+[uU]\="+ end=+"+ skip=+\\\\\|\\"+ contains=pythonEscape,pythonSthingFormat
+syn region pythonString		matchgroup=Normal start=+[uU]\="""+ end=+"""+ contains=pythonEscape,pythonStringFormat
+syn region pythonString		matchgroup=Normal start=+[uU]\='''+ end=+'''+ contains=pythonEscape,pythonStringFormat
+syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]'+ end=+'+ skip=+\\\\\|\\'+ contains=pythonStringFormat
+syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]"+ end=+"+ skip=+\\\\\|\\"+ contains=pythonStringFormat
+syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]"""+ end=+"""+ contains=pythonStringFormat
+syn region pythonRawString	matchgroup=Normal start=+[uU]\=[rR]'''+ end=+'''+ contains=pythonStringFormat
+syn match  pythonStringFormat	"%(.\{-})s" contained
+
 syn match  pythonEscape		+\\[abfnrtv'"\\]+ contained
 syn match  pythonEscape		"\\\o\{1,3}" contained
 syn match  pythonEscape		"\\x\x\{2}" contained
   HiLink pythonRepeat		Repeat
   HiLink pythonString		String
   HiLink pythonRawString	String
+  HiLink pythonStringFormat	Identifier
   HiLink pythonEscape		Special
   HiLink pythonOperator		Operator
   HiLink pythonPreCondit	PreCondit