X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8b215aac0192f74b5aeb6ae5a2e1766db2ebecb8..e0562c8f61eb871f99192b66fbdccd5fbe60dcd2:/indent/python.vim?ds=inline diff --git a/indent/python.vim b/indent/python.vim index 8a479f4..939968e 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -25,14 +25,10 @@ if exists("b:did_indent") endif let b:did_indent = 1 -setlocal expandtab setlocal nolisp setlocal autoindent setlocal indentexpr=GetPythonPEPIndent(v:lnum) setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except -setlocal tabstop=4 -setlocal softtabstop=4 -setlocal shiftwidth=4 if !exists('g:python_pep8_indent_multiline_string') let g:python_pep8_indent_multiline_string = 0 @@ -303,17 +299,19 @@ function! s:indent_like_previous_line(lnum) return base + s:sw() endif + let empty = getline(a:lnum) =~# '^\s*$' + " If the previous statement was a stop-execution statement or a pass if getline(start) =~# s:stop_statement " Remove one level of indentation if the user hasn't already dedented - if indent(a:lnum) > base - s:sw() + if empty || current > base - s:sw() return base - s:sw() endif " Otherwise, trust the user return -1 endif - if s:is_dedented_already(current, base) + if !empty && s:is_dedented_already(current, base) return -1 endif