summaryrefslogtreecommitdiffstats
path: root/runtime/indent/python.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-02-26 23:04:13 +0000
committerBram Moolenaar <Bram@vim.org>2005-02-26 23:04:13 +0000
commit05159a0c6a27a030c8497c5cf836977090f9e75d (patch)
tree9ccc167cf3e830e5d01aff4555f99d854cbb623b /runtime/indent/python.vim
parent5313dcb75ac76501f23d21ac94efdbeeabc860bc (diff)
updated for version 7.0052v7.0052
Diffstat (limited to 'runtime/indent/python.vim')
-rw-r--r--runtime/indent/python.vim11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim
index e0e8e71f1f..38ef1d259e 100644
--- a/runtime/indent/python.vim
+++ b/runtime/indent/python.vim
@@ -2,7 +2,7 @@
" Language: Python
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Original Author: David Bustos <bustos@caltech.edu>
-" Last Change: 2005 Feb 08
+" Last Change: 2005 Feb 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -22,16 +22,19 @@ if exists("*GetPythonIndent")
finish
endif
+" Come here when loading the script the first time.
+
let s:maxoff = 50 " maximum number of lines to look backwards for ()
function GetPythonIndent(lnum)
+
" If this line is explicitly joined: If the previous line was also joined,
" line it up with that one, otherwise add two 'shiftwidth'
if getline(a:lnum - 1) =~ '\\$'
if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
return indent(a:lnum - 1)
endif
- return indent(a:lnum - 1) + (&sw * 2)
+ return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2))
endif
" If the start of the line is in a string don't change the indent.
@@ -84,9 +87,9 @@ function GetPythonIndent(lnum)
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\)$'")
if pp > 0
- return indent(plnum) + &sw
+ return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : &sw)
endif
- return indent(plnum) + (&sw * 2)
+ return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (&sw * 2))
endif
if plnumstart == p
return indent(plnum)