" vim: ft=vim:fdm=marker" Enable pymode syntax for python filescall pymode#default('g:pymode', 1)call pymode#default('g:pymode_syntax', g:pymode)" DESC: Disable script loadingif !g:pymode || !g:pymode_syntax || pymode#default('b:current_syntax', 'pymode')finishendif" OPTIONS: {{{" Highlight all by defaultcall pymode#default('g:pymode_syntax_all', 1)" Highlight 'print' as functioncall pymode#default("g:pymode_syntax_print_as_function", 0)"" Highlight 'async/await' keywordscall pymode#default("g:pymode_syntax_highlight_async_await", g:pymode_syntax_all)" Highlight '=' operatorcall pymode#default('g:pymode_syntax_highlight_equal_operator', g:pymode_syntax_all)" Highlight '*' operatorcall pymode#default('g:pymode_syntax_highlight_stars_operator', g:pymode_syntax_all)" Highlight 'self' keywordcall pymode#default('g:pymode_syntax_highlight_self', g:pymode_syntax_all)" Highlight indent's errorscall pymode#default('g:pymode_syntax_indent_errors', g:pymode_syntax_all)" Highlight space's errorscall pymode#default('g:pymode_syntax_space_errors', g:pymode_syntax_all)" Highlight string formattingcall pymode#default('g:pymode_syntax_string_formatting', g:pymode_syntax_all)call pymode#default('g:pymode_syntax_string_format', g:pymode_syntax_all)call pymode#default('g:pymode_syntax_string_templates', g:pymode_syntax_all)call pymode#default('g:pymode_syntax_doctests', g:pymode_syntax_all)" Support docstrings in syntax highlightingcall pymode#default('g:pymode_syntax_docstrings', 1)" Highlight builtin objects (True, False, ...)call pymode#default('g:pymode_syntax_builtin_objs', g:pymode_syntax_all)" Highlight builtin types (str, list, ...)call pymode#default('g:pymode_syntax_builtin_types', g:pymode_syntax_all)" Highlight builtin types (div, eval, ...)call pymode#default('g:pymode_syntax_builtin_funcs', g:pymode_syntax_all)" Highlight exceptions (TypeError, ValueError, ...)call pymode#default('g:pymode_syntax_highlight_exceptions', g:pymode_syntax_all)" More slow synchronizing. Disable on the slow machine, but code in docstrings" could be broken.call pymode#default('g:pymode_syntax_slow_sync', 1)" }}}" For version 5.x: Clear all syntax itemsif version < 600syntax clearendif" Keywords {{{" ============syn keyword pythonStatement break continue delsyn keyword pythonStatement exec returnsyn keyword pythonStatement pass raisesyn keyword pythonStatement global nonlocal assertsyn keyword pythonStatement yieldsyn keyword pythonLambdaExpr lambdasyn keyword pythonStatement with assyn keyword pythonStatement def nextgroup=pythonFunction skipwhitesyn match pythonFunction "\%(\%(def\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained nextgroup=pythonVarssyn region pythonVars start="(" skip=+\(".*"\|'.*'\)+ end=")" contained contains=pythonParameters transparent keependsyn match pythonParameters "[^,]*" contained contains=pythonParam skipwhitesyn match pythonParam "[^,]*" contained contains=pythonExtraOperator,pythonLambdaExpr,pythonBuiltinObj,pythonBuiltinType,pythonConstant,pythonString,pythonNumber,pythonBrackets,pythonSelf,pythonComment skipwhitesyn match pythonBrackets "{[(|)]}" contained skipwhitesyn keyword pythonStatement class nextgroup=pythonClass skipwhitesyn match pythonClass "\%(\%(class\s\)\s*\)\@<=\h\%(\w\|\.\)*" contained nextgroup=pythonClassVarssyn region pythonClassVars start="(" end=")" contained contains=pythonClassParameters transparent keependsyn match pythonClassParameters "[^,\*]*" contained contains=pythonBuiltin,pythonBuiltinObj,pythonBuiltinType,pythonExtraOperatorpythonStatement,pythonBrackets,pythonString,pythonComment skipwhitesyn keyword pythonRepeat for whilesyn keyword pythonConditional if elif elsesyn keyword pythonInclude import fromsyn keyword pythonException try except finallysyn keyword pythonOperator and in is not orsyn match pythonExtraOperator "\%([~!^&|/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\.\.\.\|\.\.\|::\)"syn match pythonExtraPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)"if !g:pymode_syntax_print_as_functionsyn keyword pythonStatement printendifif g:pymode_syntax_highlight_async_awaitsyn keyword pythonStatement async awaitsyn match pythonStatement "\<async\s\+def\>" nextgroup=pythonFunction skipwhitesyn match pythonStatement "\<async\s\+with\>" displaysyn match pythonStatement "\<async\s\+for\>" nextgroup=pythonRepeat skipwhiteendifif g:pymode_syntax_highlight_equal_operatorsyn match pythonExtraOperator "\%(=\)"endifif g:pymode_syntax_highlight_stars_operatorsyn match pythonExtraOperator "\%(\*\|\*\*\)"endifif g:pymode_syntax_highlight_selfsyn keyword pythonSelf self clsendif" }}}" Decorators {{{" ==============syn match pythonDecorator "@" display nextgroup=pythonDottedName skipwhitesyn match pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained" }}}" Comments {{{" ============syn match pythonComment "#.*$" display contains=pythonTodo,@Spellsyn match pythonRun "\%^#!.*$"syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"syn keyword pythonTodo TODO FIXME XXX contained" }}}" Errors {{{" ==========syn match pythonError "\<\d\+\D\+\>" displaysyn match pythonError "[$?]" displaysyn match pythonError "[&|]\{2,}" displaysyn match pythonError "[=]\{3,}" display" Indent errors (mix space and tabs)if g:pymode_syntax_indent_errorssyn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 displayendif" Trailing space errorsif g:pymode_syntax_space_errorssyn match pythonSpaceError "\s\+$" displayendif" }}}" Strings {{{" ===========syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spellsyn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spellsyn region pythonString start=+[bB]\="""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spellsyn region pythonString start=+[bB]\='''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spellsyn match pythonEscape +\\[abfnrtv'"\\]+ display containedsyn match pythonEscape "\\\o\o\=\o\=" display containedsyn match pythonEscapeError "\\\o\{,2}[89]" display containedsyn match pythonEscape "\\x\x\{2}" display containedsyn match pythonEscapeError "\\x\x\=\X" display containedsyn match pythonEscape "\\$"" Unicodesyn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spellsyn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spellsyn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spellsyn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spellsyn match pythonUniEscape "\\u\x\{4}" display containedsyn match pythonUniEscapeError "\\u\x\{,3}\X" display containedsyn match pythonUniEscape "\\U\x\{8}" display containedsyn match pythonUniEscapeError "\\U\x\{,7}\X" display containedsyn match pythonUniEscape "\\N{[A-Z ]\+}" display containedsyn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained" Raw stringssyn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spellsyn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spellsyn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spellsyn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spellsyn match pythonRawEscape +\\['"]+ display transparent contained" Unicode raw stringssyn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spellsyn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spellsyn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spellsyn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spellsyn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display containedsyn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained" String formattingif g:pymode_syntax_string_formattingsyn match pythonStrFormatting "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringsyn match pythonStrFormatting "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringendif" Str.format syntaxif g:pymode_syntax_string_formatsyn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringsyn match pythonStrFormat "{\([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,pythonUniRawStringendif" String templatesif g:pymode_syntax_string_templatessyn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringsyn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringsyn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawStringendif" DocTestsif g:pymode_syntax_doctestssyn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" containedsyn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" containedendif" DocStringsif g:pymode_syntax_docstringssyn region pythonDocstring start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceErrorsyn region pythonDocstring start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceErrorendif" }}}" Numbers {{{" ===========syn match pythonHexError "\<0[xX][0-9a-fA-F_]*[g-zG-Z][0-9a-fA-F_]*[lL]\=\>" displaysyn match pythonHexNumber "\<0[xX][0-9a-fA-F_]*[0-9a-fA-F][0-9a-fA-F_]*[lL]\=\>" displaysyn match pythonOctNumber "\<0[oO][0-7_]*[0-7][0-7_]*[lL]\=\>" displaysyn match pythonBinNumber "\<0[bB][01_]*[01][01_]*[lL]\=\>" displaysyn match pythonNumber "\<[0-9][0-9_]*[lLjJ]\=\>" displaysyn match pythonFloat "\.[0-9_]*[0-9][0-9_]*\([eE][+-]\=[0-9_]*[0-9][0-9_]*\)\=[jJ]\=\>" displaysyn match pythonFloat "\<[0-9][0-9_]*[eE][+-]\=[0-9_]\+[jJ]\=\>" displaysyn match pythonFloat "\<[0-9][0-9_]*\.[0-9_]*\([eE][+-]\=[0-9_]*[0-9][0-9_]*\)\=[jJ]\=" displaysyn match pythonOctError "\<0[oO]\=[0-7_]*[8-9][0-9_]*[lL]\=\>" displaysyn match pythonBinError "\<0[bB][01_]*[2-9][0-9_]*[lL]\=\>" display" }}}" Builtins {{{" ============" Builtin objects and typesif g:pymode_syntax_builtin_objssyn keyword pythonBuiltinObj True False Ellipsis None NotImplementedsyn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__endifif g:pymode_syntax_builtin_typessyn keyword pythonBuiltinType type objectsyn keyword pythonBuiltinType str basestring unicode buffer bytearray bytes chr unichrsyn keyword pythonBuiltinType dict int long bool float complex set frozenset list tuplesyn keyword pythonBuiltinType file superendif" Builtin functionsif g:pymode_syntax_builtin_funcssyn keyword pythonBuiltinFunc __import__ abs all any applysyn keyword pythonBuiltinFunc bin callable classmethod cmp coerce compilesyn keyword pythonBuiltinFunc delattr dir divmod enumerate eval execfile filtersyn keyword pythonBuiltinFunc format getattr globals locals hasattr hash help hex idsyn keyword pythonBuiltinFunc input intern isinstance issubclass iter len map max minsyn keyword pythonBuiltinFunc next oct open ord pow property range xrangesyn keyword pythonBuiltinFunc raw_input reduce reload repr reversed round setattrsyn keyword pythonBuiltinFunc slice sorted staticmethod sum vars zipif g:pymode_syntax_print_as_functionsyn keyword pythonBuiltinFunc printendifendif" Builtin exceptions and warningsif g:pymode_syntax_highlight_exceptionssyn keyword pythonExClass BaseExceptionsyn keyword pythonExClass Exception StandardError ArithmeticErrorsyn keyword pythonExClass LookupError EnvironmentErrorsyn keyword pythonExClass AssertionError AttributeError BufferError EOFErrorsyn keyword pythonExClass FloatingPointError GeneratorExit IOErrorsyn keyword pythonExClass ImportError IndexError KeyErrorsyn keyword pythonExClass KeyboardInterrupt MemoryError NameErrorsyn keyword pythonExClass NotImplementedError OSError OverflowErrorsyn keyword pythonExClass ReferenceError RuntimeError StopIterationsyn keyword pythonExClass SyntaxError IndentationError TabErrorsyn keyword pythonExClass SystemError SystemExit TypeErrorsyn keyword pythonExClass UnboundLocalError UnicodeErrorsyn keyword pythonExClass UnicodeEncodeError UnicodeDecodeErrorsyn keyword pythonExClass UnicodeTranslateError ValueError VMSErrorsyn keyword pythonExClass BlockingIOError ChildProcessError ConnectionErrorsyn keyword pythonExClass BrokenPipeError ConnectionAbortedErrorsyn keyword pythonExClass ConnectionRefusedError ConnectionResetErrorsyn keyword pythonExClass FileExistsError FileNotFoundError InterruptedErrorsyn keyword pythonExClass IsADirectoryError NotADirectoryError PermissionErrorsyn keyword pythonExClass ProcessLookupError TimeoutErrorsyn keyword pythonExClass WindowsError ZeroDivisionErrorsyn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarningsyn keyword pythonExClass PendingDepricationWarning SyntaxWarningsyn keyword pythonExClass RuntimeWarning FutureWarningsyn keyword pythonExClass ImportWarning UnicodeWarningendif" }}}if g:pymode_syntax_slow_syncsyn sync minlines=2000else" This is fast but code inside triple quoted strings screws it up. It" is impossible to fix because the only way to know if you are inside a" triple quoted string is to start from the beginning of the file.syn sync match pythonSync grouphere NONE "):$"syn sync maxlines=200endif" Highlight {{{" =============hi def link pythonStatement Statementhi def link pythonLambdaExpr Statementhi def link pythonInclude Includehi def link pythonFunction Functionhi def link pythonClass Typehi def link pythonParameters Normalhi def link pythonParam Normalhi def link pythonBrackets Normalhi def link pythonClassParameters Normalhi def link pythonSelf Identifierhi def link pythonConditional Conditionalhi def link pythonRepeat Repeathi def link pythonException Exceptionhi def link pythonOperator Operatorhi def link pythonExtraOperator Operatorhi def link pythonExtraPseudoOperator Operatorhi def link pythonDecorator Definehi def link pythonDottedName Functionhi def link pythonComment Commenthi def link pythonCoding Specialhi def link pythonRun Specialhi def link pythonTodo Todohi def link pythonError Errorhi def link pythonIndentError Errorhi def link pythonSpaceError Errorhi def link pythonString Stringhi def link pythonDocstring Stringhi def link pythonUniString Stringhi def link pythonRawString Stringhi def link pythonUniRawString Stringhi def link pythonEscape Specialhi def link pythonEscapeError Errorhi def link pythonUniEscape Specialhi def link pythonUniEscapeError Errorhi def link pythonUniRawEscape Specialhi def link pythonUniRawEscapeError Errorhi def link pythonStrFormatting Specialhi def link pythonStrFormat Specialhi def link pythonStrTemplate Specialhi def link pythonDocTest Specialhi def link pythonDocTest2 Specialhi def link pythonNumber Numberhi def link pythonHexNumber Numberhi def link pythonOctNumber Numberhi def link pythonBinNumber Numberhi def link pythonFloat Floathi def link pythonOctError Errorhi def link pythonHexError Errorhi def link pythonBinError Errorhi def link pythonBuiltinType Typehi def link pythonBuiltinObj Structurehi def link pythonBuiltinFunc Functionhi def link pythonExClass Structure" }}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。