├── LICENSE ├── README ├── indent └── python.vim └── syntax └── python.vim /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 by Armin Ronacher, 2007-2013 Dmitry Vasiliev and 2 | Neil Schemenauer, Hynek Schlawack, Eric Mc Sween, David Bustos. 3 | 4 | Some rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | 18 | * The names of the contributors may not be used to endorse or 19 | promote products derived from this software without specific 20 | prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Combined Python 2/3 for Vim 2 | --------------------------- 3 | 4 | Fork of the python.vim by Dmitry Vasiliev and Neil Schemenauer. 5 | 6 | Features 7 | -------- 8 | 9 | - Syntax highlighting 10 | - Supports 2.x and 3.x features. 11 | - PEP8 inspired indentation with extra handling. 12 | 13 | Installation 14 | ------------ 15 | 16 | If you don't have a preferred installation method, I recommend installing 17 | pathogen.vim, and then simply copy and paste: 18 | 19 | cd ~/.vim/bundle 20 | git clone git://github.com/mitsuhiko/vim-python-combined.git 21 | -------------------------------------------------------------------------------- /indent/python.vim: -------------------------------------------------------------------------------- 1 | " PEP8 compatible Python indent file 2 | " Only load this indent file when no other was loaded. 3 | if exists("b:did_indent") 4 | finish 5 | endif 6 | let b:did_indent = 1 7 | 8 | setlocal expandtab 9 | setlocal nolisp 10 | setlocal autoindent 11 | setlocal indentexpr=GetPythonPEPIndent(v:lnum) 12 | setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except 13 | 14 | let s:maxoff = 50 15 | 16 | " Find backwards the closest open parenthesis/bracket/brace. 17 | function! s:SearchParensPair() 18 | let line = line('.') 19 | let col = col('.') 20 | 21 | " Skip strings and comments and don't look too far 22 | let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" . 23 | \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' . 24 | \ '"string\\|comment"' 25 | 26 | " Search for parentheses 27 | call cursor(line, col) 28 | let parlnum = searchpair('(', '', ')', 'bW', skip) 29 | let parcol = col('.') 30 | 31 | " Search for brackets 32 | call cursor(line, col) 33 | let par2lnum = searchpair('\[', '', '\]', 'bW', skip) 34 | let par2col = col('.') 35 | 36 | " Search for braces 37 | call cursor(line, col) 38 | let par3lnum = searchpair('{', '', '}', 'bW', skip) 39 | let par3col = col('.') 40 | 41 | " Get the closest match 42 | if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol) 43 | let parlnum = par2lnum 44 | let parcol = par2col 45 | endif 46 | if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol) 47 | let parlnum = par3lnum 48 | let parcol = par3col 49 | endif 50 | 51 | " Put the cursor on the match 52 | if parlnum > 0 53 | call cursor(parlnum, parcol) 54 | endif 55 | return parlnum 56 | endfunction 57 | 58 | " Find the start of a multi-line statement 59 | function! s:StatementStart(lnum) 60 | let lnum = a:lnum 61 | while 1 62 | if getline(lnum - 1) =~ '\\$' 63 | let lnum = lnum - 1 64 | else 65 | call cursor(lnum, 1) 66 | let maybe_lnum = s:SearchParensPair() 67 | if maybe_lnum < 1 68 | return lnum 69 | else 70 | let lnum = maybe_lnum 71 | endif 72 | endif 73 | endwhile 74 | endfunction 75 | 76 | " Find the block starter that matches the current line 77 | function! s:BlockStarter(lnum, block_start_re) 78 | let lnum = a:lnum 79 | let maxindent = 10000 " whatever 80 | while lnum > 1 81 | let lnum = prevnonblank(lnum - 1) 82 | if indent(lnum) < maxindent 83 | if getline(lnum) =~ a:block_start_re 84 | return lnum 85 | else 86 | let maxindent = indent(lnum) 87 | " It's not worth going further if we reached the top level 88 | if maxindent == 0 89 | return -1 90 | endif 91 | endif 92 | endif 93 | endwhile 94 | return -1 95 | endfunction 96 | 97 | function! GetPythonPEPIndent(lnum) 98 | let scol = col('.') 99 | 100 | " First line has indent 0 101 | if a:lnum == 1 102 | return 0 103 | endif 104 | 105 | " If we can find an open parenthesis/bracket/brace, line up with it. 106 | call cursor(a:lnum, 1) 107 | let parlnum = s:SearchParensPair() 108 | if parlnum > 0 109 | let parcol = col('.') 110 | let matches = matchlist(getline(a:lnum), '^\(\s*\)[])}]') 111 | if len(matches) == 0 112 | let closing_paren = 0 113 | let closing_paren_pos = 0 114 | else 115 | let closing_paren = 1 116 | let closing_paren_pos = len(matches[1]) 117 | endif 118 | if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1 119 | if closing_paren 120 | return indent(parlnum) 121 | else 122 | return indent(parlnum) + &shiftwidth 123 | endif 124 | elseif a:lnum - 1 != parlnum 125 | if closing_paren && closing_paren_pos > scol 126 | return indent(parlnum) 127 | else 128 | let lastindent = match(getline(a:lnum - 1), '\S') 129 | if lastindent != -1 && lastindent < parcol 130 | return lastindent 131 | endif 132 | endif 133 | endif 134 | 135 | " If we line up with an opening column there is a special case 136 | " we want to handle: a docstring as argument. In that case we 137 | " don't want to line up with the paren but with the statement 138 | " imagine foo(doc=""" as example 139 | echo getline(parlnum) 140 | if match(getline(parlnum), '\("""\|' . "'''" . '\)\s*$') != -1 141 | return indent(parlnum) 142 | endif 143 | 144 | return parcol 145 | endif 146 | 147 | " Examine this line 148 | let thisline = getline(a:lnum) 149 | let thisindent = indent(a:lnum) 150 | 151 | " If the line starts with 'elif' or 'else', line up with 'if' or 'elif' 152 | if thisline =~ '^\s*\(elif\|else\)\>' 153 | let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>') 154 | if bslnum > 0 155 | return indent(bslnum) 156 | else 157 | return -1 158 | endif 159 | endif 160 | 161 | " If the line starts with 'except' or 'finally', line up with 'try' 162 | " or 'except' 163 | if thisline =~ '^\s*\(except\|finally\)\>' 164 | let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>') 165 | if bslnum > 0 166 | return indent(bslnum) 167 | else 168 | return -1 169 | endif 170 | endif 171 | 172 | " Examine previous line 173 | let plnum = a:lnum - 1 174 | let pline = getline(plnum) 175 | let sslnum = s:StatementStart(plnum) 176 | 177 | " If the previous line is blank, keep the same indentation 178 | if pline =~ '^\s*$' 179 | return -1 180 | endif 181 | 182 | " If this line is explicitly joined, try to find an indentation that looks 183 | " good. 184 | if pline =~ '\\$' 185 | let compound_statement = '^\s*\(if\|while\|from\|import\|for\s.*\sin\|except\)\s*' 186 | let maybe_indent = matchend(getline(sslnum), compound_statement) 187 | if maybe_indent != -1 188 | return maybe_indent 189 | else 190 | return indent(sslnum) + &sw * 2 191 | endif 192 | endif 193 | 194 | " If the previous line ended with a colon and is not a comment, indent 195 | " relative to statement start. 196 | if pline =~ '^[^#]*:\s*\(#.*\)\?$' 197 | return indent(sslnum) + &sw 198 | endif 199 | 200 | " If the previous line was a stop-execution statement or a pass 201 | if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' 202 | " See if the user has already dedented 203 | if indent(a:lnum) > indent(sslnum) - &sw 204 | " If not, recommend one dedent 205 | return indent(sslnum) - &sw 206 | endif 207 | " Otherwise, trust the user 208 | return -1 209 | endif 210 | 211 | " In all other cases, line up with the start of the previous statement. 212 | return indent(sslnum) 213 | endfunction 214 | -------------------------------------------------------------------------------- /syntax/python.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " 3 | " Based on python.vim (from Vim 6.1 distribution) 4 | " by Neil Schemenauer 5 | " 6 | " Notes Armin: 7 | " 8 | " This version of the syntax file works better for 2.x and 3.x without 9 | " having to switch modes. 10 | " 11 | " Thanks: 12 | " 13 | " Jeroen Ruigrok van der Werven 14 | " for the idea of highlighting for erroneous operators 15 | " Pedro Algarvio 16 | " for the patch to enable spell checking only for the right spots 17 | " (strings and comments) 18 | 19 | " 20 | " Options: 21 | " 22 | " For set option do: let OPTION_NAME = 1 23 | " For clear option do: let OPTION_NAME = 0 24 | " 25 | " Option names: 26 | " 27 | " For highlight builtin functions: 28 | " python_highlight_builtins 29 | " 30 | " For highlight standard exceptions: 31 | " python_highlight_exceptions 32 | " 33 | " For highlight string formatting: 34 | " python_highlight_string_formatting 35 | " 36 | " For highlight indentation errors: 37 | " python_highlight_indent_errors 38 | " 39 | " For highlight trailing spaces: 40 | " python_highlight_space_errors 41 | " 42 | " For highlight doc-tests: 43 | " python_highlight_doctests 44 | " 45 | " If you want all possible Python highlighting: 46 | " (This option not override previously set options) 47 | " python_highlight_all 48 | " 49 | " For fast machines: 50 | " python_slow_sync 51 | " 52 | 53 | " For version 5.x: Clear all syntax items 54 | " For version 6.x: Quit when a syntax file was already loaded 55 | if version < 600 56 | syntax clear 57 | elseif exists("b:current_syntax") 58 | finish 59 | endif 60 | 61 | if exists("python_highlight_all") && python_highlight_all != 0 62 | " Not override previously set options 63 | if !exists("python_highlight_builtins") 64 | let python_highlight_builtins = 1 65 | endif 66 | if !exists("python_highlight_exceptions") 67 | let python_highlight_exceptions = 1 68 | endif 69 | if !exists("python_highlight_string_formatting") 70 | let python_highlight_string_formatting = 1 71 | endif 72 | if !exists("python_highlight_indent_errors") 73 | let python_highlight_indent_errors = 1 74 | endif 75 | if !exists("python_highlight_space_errors") 76 | let python_highlight_space_errors = 1 77 | endif 78 | if !exists("python_highlight_doctests") 79 | let python_highlight_doctests = 1 80 | endif 81 | endif 82 | 83 | " Keywords 84 | syn keyword pythonStatement break continue del 85 | syn keyword pythonStatement exec return 86 | syn keyword pythonStatement pass raise 87 | syn keyword pythonStatement global assert 88 | syn keyword pythonStatement lambda yield 89 | syn keyword pythonStatement async await 90 | syn keyword pythonStatement with nonlocal True False None 91 | syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite 92 | syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained 93 | syn keyword pythonRepeat for while 94 | syn keyword pythonConditional if elif else 95 | syn keyword pythonImport import from as 96 | syn keyword pythonException try except finally 97 | syn keyword pythonOperator and in is not or 98 | 99 | " Print keyword but only if not used as function 100 | syn match pythonStatement "\\((\|,\|*=\)\@!" display 101 | 102 | " Decorators (new in Python 2.4) 103 | syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite 104 | 105 | " Comments 106 | syn match pythonComment "#.*$" display contains=pythonTodo,@Spell 107 | syn match pythonRun "\%^#!.*$" 108 | syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$" 109 | syn keyword pythonTodo TODO FIXME XXX contained 110 | 111 | " Errors 112 | syn match pythonError "\<\d\+\D\+\>" display 113 | syn match pythonError "[$?]" display 114 | syn match pythonError "[-+&|]\{2,}" display 115 | syn match pythonError "[=]\{3,}" display 116 | 117 | " TODO: Mixing spaces and tabs also may be used for pretty formatting multiline 118 | " statements. For now I don't know how to work around this. 119 | if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0 120 | syn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 display 121 | endif 122 | 123 | " Trailing space errors 124 | if exists("python_highlight_space_errors") && python_highlight_space_errors != 0 125 | syn match pythonSpaceError "\s\+$" display 126 | endif 127 | 128 | " Strings 129 | syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell 130 | syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell 131 | syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell 132 | syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell 133 | 134 | syn match pythonEscape +\\[abfnrtv'"\\]+ display contained 135 | syn match pythonEscape "\\\o\o\=\o\=" display contained 136 | syn match pythonEscapeError "\\\o\{,2}[89]" display contained 137 | syn match pythonEscape "\\x\x\{2}" display contained 138 | syn match pythonEscapeError "\\x\x\=\X" display contained 139 | syn match pythonEscape "\\$" 140 | 141 | " Byte-Strings 142 | syn region pythonBString start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell 143 | syn region pythonBString start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell 144 | syn region pythonBString start=+[bB]"""+ end=+"""+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest2,pythonSpaceError,@Spell 145 | syn region pythonBString start=+[bB]'''+ end=+'''+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest,pythonSpaceError,@Spell 146 | 147 | syn match pythonBEscape +\\[abfnrtv'"\\]+ display contained 148 | syn match pythonBEscape "\\\o\o\=\o\=" display contained 149 | syn match pythonBEscapeError "\\\o\{,2}[89]" display contained 150 | syn match pythonBEscape "\\x\x\{2}" display contained 151 | syn match pythonBEscapeError "\\x\x\=\X" display contained 152 | syn match pythonBEscape "\\$" 153 | 154 | " Unicode strings 155 | syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell 156 | syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell 157 | syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell 158 | syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell 159 | 160 | syn match pythonUniEscape "\\u\x\{4}" display contained 161 | syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained 162 | syn match pythonUniEscape "\\U\x\{8}" display contained 163 | syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained 164 | syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained 165 | syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained 166 | 167 | " Raw strings 168 | syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell 169 | syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell 170 | syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell 171 | syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell 172 | 173 | syn match pythonRawEscape +\\['"]+ display transparent contained 174 | 175 | " Unicode raw strings 176 | syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell 177 | syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell 178 | syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell 179 | syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell 180 | 181 | syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained 182 | syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained 183 | 184 | if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0 185 | " String formatting 186 | syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString 187 | syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString 188 | endif 189 | 190 | if exists("python_highlight_doctests") && python_highlight_doctests != 0 191 | " DocTests 192 | syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained 193 | syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained 194 | endif 195 | 196 | " Numbers (ints, longs, floats, complex) 197 | syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display 198 | syn match pythonHexNumber "\<0[xX]\>" display 199 | syn match pythonNumber "\<\d\+[lLjJ]\=\>" display 200 | syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display 201 | syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display 202 | syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display 203 | 204 | syn match pythonOctalError "\<0\o*[89]\d*[lL]\=\>" display 205 | syn match pythonHexError "\<0[xX]\X\+[lL]\=\>" display 206 | 207 | if exists("python_highlight_builtins") && python_highlight_builtins != 0 208 | " Builtin functions, types and objects 209 | syn keyword pythonBuiltinObj Ellipsis NotImplemented 210 | 211 | syn keyword pythonBuiltinFunc __import__ abs all any apply 212 | syn keyword pythonBuiltinFunc basestring bool buffer bytearray bytes callable 213 | syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex 214 | syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval 215 | syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr 216 | syn keyword pythonBuiltinfunc globals hasattr hash help hex id 217 | syn keyword pythonBuiltinFunc input int intern isinstance 218 | syn keyword pythonBuiltinFunc issubclass iter len list locals long map max 219 | syn keyword pythonBuiltinFunc min object oct open ord pow property range 220 | syn keyword pythonBuiltinFunc raw_input reduce reload repr 221 | syn keyword pythonBuiltinFunc reversed round set setattr 222 | syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple 223 | syn keyword pythonBuiltinFunc type unichr unicode vars xrange zip 224 | endif 225 | 226 | if exists("python_highlight_exceptions") && python_highlight_exceptions != 0 227 | " Builtin exceptions and warnings 228 | syn keyword pythonExClass BaseException 229 | syn keyword pythonExClass Exception StandardError ArithmeticError 230 | syn keyword pythonExClass LookupError EnvironmentError 231 | 232 | syn keyword pythonExClass AssertionError AttributeError EOFError 233 | syn keyword pythonExClass FloatingPointError GeneratorExit IOError 234 | syn keyword pythonExClass ImportError IndexError KeyError 235 | syn keyword pythonExClass KeyboardInterrupt MemoryError NameError 236 | syn keyword pythonExClass NotImplementedError OSError OverflowError 237 | syn keyword pythonExClass ReferenceError RuntimeError StopIteration 238 | syn keyword pythonExClass SyntaxError IndentationError TabError 239 | syn keyword pythonExClass SystemError SystemExit TypeError 240 | syn keyword pythonExClass UnboundLocalError UnicodeError 241 | syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError 242 | syn keyword pythonExClass UnicodeTranslateError ValueError 243 | syn keyword pythonExClass WindowsError ZeroDivisionError 244 | 245 | syn keyword pythonExClass Warning UserWarning DeprecationWarning 246 | syn keyword pythonExClass PendingDepricationWarning SyntaxWarning 247 | syn keyword pythonExClass RuntimeWarning FutureWarning OverflowWarning 248 | syn keyword pythonExClass ImportWarning UnicodeWarning 249 | endif 250 | 251 | if exists("python_slow_sync") && python_slow_sync != 0 252 | syn sync minlines=2000 253 | else 254 | " This is fast but code inside triple quoted strings screws it up. It 255 | " is impossible to fix because the only way to know if you are inside a 256 | " triple quoted string is to start from the beginning of the file. 257 | syn sync match pythonSync grouphere NONE "):$" 258 | syn sync maxlines=200 259 | endif 260 | 261 | if version >= 508 || !exists("did_python_syn_inits") 262 | if version <= 508 263 | let did_python_syn_inits = 1 264 | command -nargs=+ HiLink hi link 265 | else 266 | command -nargs=+ HiLink hi def link 267 | endif 268 | 269 | HiLink pythonStatement Statement 270 | HiLink pythonImport Statement 271 | HiLink pythonFunction Function 272 | HiLink pythonConditional Conditional 273 | HiLink pythonRepeat Repeat 274 | HiLink pythonException Exception 275 | HiLink pythonOperator Operator 276 | 277 | HiLink pythonDecorator Define 278 | 279 | HiLink pythonComment Comment 280 | HiLink pythonCoding Special 281 | HiLink pythonRun Special 282 | HiLink pythonTodo Todo 283 | 284 | HiLink pythonError Error 285 | HiLink pythonIndentError Error 286 | HiLink pythonSpaceError Error 287 | 288 | HiLink pythonString String 289 | HiLink pythonBString String 290 | HiLink pythonUniString String 291 | HiLink pythonRawString String 292 | HiLink pythonUniRawString String 293 | 294 | HiLink pythonEscape Special 295 | HiLink pythonBEscape Special 296 | HiLink pythonEscapeError Error 297 | HiLink pythonBEscapeError Error 298 | HiLink pythonUniEscape Special 299 | HiLink pythonUniEscapeError Error 300 | HiLink pythonUniRawEscape Special 301 | HiLink pythonUniRawEscapeError Error 302 | 303 | HiLink pythonStrFormat Special 304 | 305 | HiLink pythonDocTest Special 306 | HiLink pythonDocTest2 Special 307 | 308 | HiLink pythonNumber Number 309 | HiLink pythonHexNumber Number 310 | HiLink pythonFloat Float 311 | HiLink pythonOctalError Error 312 | HiLink pythonHexError Error 313 | 314 | HiLink pythonBuiltinObj Structure 315 | HiLink pythonBuiltinFunc Function 316 | 317 | HiLink pythonExClass Structure 318 | 319 | delcommand HiLink 320 | endif 321 | 322 | let b:current_syntax = "python" 323 | --------------------------------------------------------------------------------