Skip to content

Commit 5231a90

Browse files
committed
fix some highlighting bugs
1 parent 1a0e264 commit 5231a90

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

syntax/python.vim

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
" Vim syntax file
2-
" ModAuthor: Mathias Köhler
3-
" Modiefied version of:
4-
" Language: Python
5-
" Maintainer: Dmitry Vasiliev <dima at hlabs dot org>
6-
" URL: https://github.com/hdima/vim-scripts/blob/master/syntax/python/python.vim
7-
" Last Change: 2012-02-11
8-
" Filenames: *.py
9-
" Version: 2.6.7
102
"
11-
" Based on python.vim (from Vim 6.1 distribution)
12-
" by Neil Schemenauer <nas at python dot ca>
3+
" Modification:
4+
"
5+
" Author: Mathias Koehler
6+
" Last Change: 2012-03-05
7+
"
8+
" Based on:
9+
"
10+
" Language: Python
11+
" Maintainer: Dmitry Vasiliev <dima at hlabs dot org>
12+
" URL: https://github.com/hdima/vim-scripts/blob/master/syntax/python/python.vim
13+
" Last Change: 2012-02-11
14+
" Filenames: *.py
15+
" Version: 2.6.7
16+
"
17+
" Which based on python.vim (from Vim 6.1 distribution)
18+
" by Neil Schemenauer <nas at python dot ca>
1319
"
1420
" Thanks:
1521
"
@@ -143,9 +149,9 @@ syn region pythonParam start="[a-zA-Z_]" end="\(,\|)\s*:\)" contained contains
143149
syn match pythonParamName "[a-zA-Z_][a-zA-Z0-9_]*" contained nextgroup=pythonDefaultAssignment skipwhite skipnl
144150
syn match pythonDefaultAssignment "=" nextgroup=pythonParamDefault skipwhite contained skipnl
145151

146-
syn region pythonFuncCall start="[a-zA-Z_][a-zA-Z0-9_]*(" end=")" keepend contains=pythonFuncCallName,pythonFuncCallArgs
152+
syn region pythonFuncCall start="[a-zA-Z_][a-zA-Z0-9_]*(" end=")" contains=pythonFuncCallName,pythonFuncCallArgs
147153
syn match pythonFuncCallName "[a-zA-Z_][a-zA-Z0-9_]*" display contained nextgroup=pythonFuncCallArgs skipwhite
148-
syn region pythonFuncCallArgs start="("ms=s+1 end=")"me=e-1 contained contains=@pythonStringType,@pythonNumberType,@pythonBuiltin,pythonFuncCallKwargs
154+
syn region pythonFuncCallArgs start="("ms=s+1 end=")"me=e-1 contained contains=pythonFuncCall,@pythonStringType,@pythonNumberType,@pythonBuiltin,pythonFuncCallKwargs
149155

150156
syn match pythonFuncCallKwargs "[a-zA-Z_][a-zA-Z0-9_]*\s*=" display contained contains=pythonKey,pythonKeyAssign
151157
syn match pythonKey "[a-zA-Z_][a-zA-Z0-9_]*" display contained nextgroup=pythonKeyAssign skipwhite
@@ -255,8 +261,10 @@ if exists("python_highlight_string_templates") && python_highlight_string_templa
255261
syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
256262
endif
257263

258-
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
259-
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
264+
if exists("python_highlight_doctests") && python_highlight_doctests != 0
265+
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
266+
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
267+
endif
260268

261269
" Numbers (ints, longs, floats, complex)
262270
syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\x*[lL]\=\>" display

0 commit comments

Comments
 (0)