File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -221,10 +221,14 @@ function! s:indent_like_opening_paren(lnum)
221221 " indent further to distinguish the continuation line
222222 " from the next logical line.
223223 if text = ~# b: control_statement && res == base + s: sw ()
224- return base + s: sw () * 2
225- else
226- return res
224+ let res = base + s: sw () * 2
225+ endif
226+
227+ " If a colon is the final charactar on previous line
228+ if getline (a: lnum- 1 ) = ~ ' :\s*$'
229+ let res = res + s: sw ()
227230 endif
231+ return res
228232endfunction
229233
230234" Match indent of first block of this type.
Original file line number Diff line number Diff line change 9191 end
9292 end
9393
94+ describe "after a dictionary key" do
95+ before { vim . feedkeys 'imydict = {"12345": ' }
96+
97+ it "indents to opening paren + shiftwidth" do
98+ vim . feedkeys '\<CR>'
99+ indent . should == 10 + shiftwidth
100+ end
101+ it "on a new line indents to opening paren + shiftwidth" do
102+ vim . feedkeys '123,\<CR>"4567": '
103+ indent . should == 10
104+ vim . feedkeys '\<CR>'
105+ indent . should == 10 + shiftwidth
106+ end
107+ end
108+
109+
94110 describe "when using gq to reindent a '(' that is" do
95111 before { vim . feedkeys 'itest(' }
96112 it "something and has a string without spaces at the end" do
You can’t perform that action at this time.
0 commit comments