File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,12 @@ function! s:indent_like_opening_paren(lnum)
222222 if starts_with_closing_paren && ! hang_closing
223223 let res = base
224224 else
225- return base + s: sw ()
225+ let res = base + s: sw ()
226+
227+ " Special case for parenthesis.
228+ if text[paren_col- 1 ] == # ' (' && getline (a: lnum ) !~# ' \v\)\s*:?\s*$'
229+ return res
230+ endif
226231 endif
227232 else
228233 " Indent to match position of opening paren.
Original file line number Diff line number Diff line change 203203 end
204204
205205 describe "when using a function definition" do
206- it "indents shiftwidth spaces " do
206+ it "handles indent with closing parenthesis on same line " do
207207 vim . feedkeys 'idef long_function_name(\<CR>arg'
208208 indent . should == shiftwidth
209+ vim . feedkeys '):'
210+ indent . should == shiftwidth * 2
211+ end
212+
213+ it "handles indent with closing parenthesis on new line" do
214+ vim . feedkeys 'idef long_function_name(\<CR>arg'
215+ indent . should == shiftwidth
216+ vim . feedkeys '\<CR>'
217+ indent . should == shiftwidth
218+ vim . feedkeys ')'
219+ indent . should == ( hang_closing ? shiftwidth * 2 : 0 )
220+ vim . feedkeys ':'
221+ indent . should == ( hang_closing ? shiftwidth * 2 : 0 )
222+ vim . feedkeys '\<Esc>k'
223+ indent . should == shiftwidth
209224 end
210225 end
211226
You can’t perform that action at this time.
0 commit comments