+ it "indents by one level for 10 lines" do
+ vim.command('set paste | exe "norm 9o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+
+ it "indents by one level for 100 lines" do
+ vim.command('set paste | exe "norm 99o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "Handles far away opening curly brackets" do
+ before { vim.feedkeys '\<ESC>ggdGijson = {' }
+
+ it "indents by one level" do
+ vim.feedkeys '\<CR>'
+ vim.feedkeys '\<Esc>o'
+ proposed_indent.should == shiftwidth
+ end
+
+ it "indents by one level for 10 lines" do
+ vim.command('set paste | exe "norm 9o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+
+ it "indents by one level for 1000 lines" do
+ vim.command('set paste | exe "norm 999o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "Compact multiline dict" do
+ before { vim.feedkeys '\<ESC>ggdGid = {"one": 1,' }
+
+ it "gets indented correctly" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 5
+
+ vim.feedkeys '"two": 2}'
+ proposed_indent.should == 5
+
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 0
+ end
+end
+
+describe "Using O" do
+ before { vim.feedkeys 'iif foo:\<CR>' }
+
+ it "respects autoindent" do
+ vim.feedkeys '1\<CR>\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys '\<Esc>ko'
+ indent.should == shiftwidth
+ vim.feedkeys '\<Esc>kO'
+ indent.should == shiftwidth
+ # Uses/keeps indent from line above
+ vim.feedkeys '\<Esc>i2\<Esc>O'
+ indent.should == shiftwidth
+ # Uses/keeps indent from line above
+ vim.feedkeys '\<Esc>j\<Esc>O'
+ indent.should == 0
+ end
+end
+
+describe "searchpairpos" do
+ before { vim.feedkeys '\<ESC>ggdG' }
+ it "handles nested parenthesis" do
+ vim.feedkeys 'iif foo.startswith("("):\<CR>'
+ indent.should == shiftwidth