File tree 2 files changed +23
-3
lines changed
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)
221
221
" indent further to distinguish the continuation line
222
222
" from the next logical line.
223
223
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 character on previous line
228
+ if getline (a: lnum- 1 ) = ~ ' :\s*$'
229
+ let res = res + s: sw ()
227
230
endif
231
+ return res
228
232
endfunction
229
233
230
234
" Match indent of first block of this type.
Original file line number Diff line number Diff line change 91
91
end
92
92
end
93
93
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
+
94
110
describe "when using gq to reindent a '(' that is" do
95
111
before { vim . feedkeys 'itest(' }
96
112
it "something and has a string without spaces at the end" do
You can’t perform that action at this time.
0 commit comments