File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,7 +137,11 @@ function! GetPEP8PythonIndent() abort
137137 elseif getline (v: lnum - 1 ) = ~# s: lcont
138138 " line continuation
139139 if s: is_compound_stmt (ll )
140- let ind += s: ml_stmt () ? shiftwidth () * 2 : shiftwidth ()
140+ if ll = ~# ' \v^\s*<with>'
141+ let ind += len (' with' ) + 1
142+ else
143+ let ind += s: ml_stmt () ? shiftwidth () * 2 : shiftwidth ()
144+ endif
141145 else
142146 let ind += s: cont ()
143147 endif
Original file line number Diff line number Diff line change @@ -492,6 +492,15 @@ Describe filetype indent
492492 Assert Equals(Insert(in), Buffer(out))
493493 End
494494
495+ It indents the with statement (line continuation)
496+ let in = "with open('a') as fp1, \\\<CR>open('b') as fp2:"
497+ let out = [
498+ \ 'with open(''a'') as fp1, \',
499+ \ ' open(''b'') as fp2:',
500+ \]
501+ Assert Equals(Insert(in), Buffer(out))
502+ End
503+
495504 It indents compound statements (line continuation)
496505 let in = "def func():\<CR>"
497506 let in .= "\\\<CR>0\<C-D>if 1:\<CR>pass\<CR>"
You can’t perform that action at this time.
0 commit comments