Created
December 9, 2010 18:37
-
-
Save MicahElliott/735113 to your computer and use it in GitHub Desktop.
Patch to add special comments support to v3.0.6 for vim python syntax.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- py3-orig.vim 2010-12-09 09:46:45.311794900 -0800 | |
+++ py3.vim 2010-12-09 10:35:17.895552660 -0800 | |
@@ -137,7 +137,21 @@ | |
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell | |
syn match pythonRun "\%^#!.*$" | |
syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$" | |
-syn keyword pythonTodo TODO FIXME XXX contained | |
+ | |
+" Special non-standard comment types, to rainbow-ify your code. | |
+syn match pythonCommentedCode "##\w.*$" display | |
+syn match pythonKingComment "### .*$" display | |
+syn match pythonMajorSection "####*$" display | |
+syn match pythonMinorSection "#---*$" display | |
+syn match pythonSmartComment "###\w.*$" display | |
+"syn match pythonInfoComment "#\s\w.*$" display | |
+syn match pythonDisabledComment "#\w.*$" display | |
+syn match pythonJavadoc " \+@\w\+:" display | |
+syn match pythonEpydoc " \+:\w\+:" display | |
+"syn region pythonEolComment start="\w.* \+# \w.*$" end="$" display excludenl | |
+ | |
+" Extended support for non-traditional Codetags (see PEP 350). | |
+syn keyword pythonTodo TODO FIXME RFE QSTN HACK FAQ SEE STAT RVDBY WKRD XXX ??? BUG REQ GLOSS FTRQ CAV IDEA NOTE PORT CRED WARN WARNING contained | |
" Errors | |
syn match pythonError "\<\d\+\D\+\>" display | |
@@ -159,8 +173,12 @@ | |
" Strings | |
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell | |
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell | |
-syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell | |
-syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell | |
+ | |
+" Special block triple-strings (differentiation for flexible semantic differentiation). | |
+" You might use ticks for disabling code, but dirks for actual documentation. | |
+syn region pythonTripleDirkString start=+[bB]\="""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,pythonJavadoc,pythonEpydoc,@Spell | |
+syn region pythonTripleTickString start=+[bB]\='''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell | |
+ | |
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained | |
syn match pythonEscape "\\\o\o\=\o\=" display contained | |
@@ -207,8 +225,8 @@ | |
if exists("python_highlight_string_format") && python_highlight_string_format != 0 | |
" str.format syntax | |
- syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString | |
- syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString | |
+ syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonTripleDirkString,pythonTripleTickString,pythonRawString | |
+ syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonTripleDirkString,pythonTripleTickString,pythonRawString | |
endif | |
if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 | |
@@ -332,6 +350,8 @@ | |
HiLink pythonSpaceError Error | |
HiLink pythonString String | |
+ HiLink pythonTripleDirkString String | |
+ HiLink pythonTripleTickString String | |
HiLink pythonRawString String | |
HiLink pythonEscape Special | |
HiLink pythonEscapeError Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment