+if !exists('g:python_pep8_indent_multiline_string')
+ let g:python_pep8_indent_multiline_string = 0
+endif
+
+if !exists('g:python_pep8_indent_hang_closing')
+ let g:python_pep8_indent_hang_closing = 0
+endif
+
+let s:block_rules = {
+ \ '^\s*elif\>': ['if', 'elif'],
+ \ '^\s*except\>': ['try', 'except'],
+ \ '^\s*finally\>': ['try', 'except', 'else']
+ \ }
+let s:block_rules_multiple = {
+ \ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
+ \ }
+" Pairs to look for when searching for opening parenthesis.
+" The value is the maximum offset in lines.
+let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
+
+if &filetype ==# 'pyrex' || &filetype ==# 'cython'
+ let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
+else
+ let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
+endif
+let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+
+" Skip strings and comments. Return 1 for chars to skip.
+" jedi* refers to syntax definitions from jedi-vim for call signatures, which
+" are inserted temporarily into the buffer.
+let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"'
+
+let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "\\vcomment|jedi\\S"'
+
+" Also ignore anything concealed.
+" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
+function! s:is_concealed(line, col)
+ let concealed = synconcealed(a:line, a:col)
+ return len(concealed) && concealed[0]
+endfunction
+if has('conceal')
+ let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
+endif
+
+
+" Use 'shiftwidth()' instead of '&sw'.
+" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
+if exists('*shiftwidth')
+ function! s:sw()
+ return shiftwidth()
+ endfunction
+else
+ function! s:sw()
+ return &shiftwidth
+ endfunction
+endif