Я сделал несколько собственных модов indent/python.vim
, чтобы включить полный отступ при вводе третьей пустой строки. Возможно, вы сможете адаптировать это к вашим потребностям.
diff --git a/python.vim b/python.vim
index 0c04e81..c60c30e 100644
--- a/python.vim
+++ b/python.vim
@@ -142,8 +142,14 @@ function GetPythonIndent(lnum)
" If not, recommend one dedent
return indent(plnum) - &sw
endif
- " Otherwise, trust the user
- return -1
+
+ " Is user trying to break out of this function?
+ if plnum < a:lnum - 2
+ return 0
+ else
+ " Otherwise, trust the user
+ return -1
+ endif
endif
" If the current line begins with a keyword that lines up with "try"
@@ -186,6 +192,11 @@ function GetPythonIndent(lnum)
return plindent
endif
+ " Double linebreaks means we're starting a new function (probably)
+ if plnum < a:lnum - 2
+ return 0
+ endif
+
return -1
endfunction