]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Keep/handle (auto)indent with O (#119)
authorDaniel Hahler <github@thequod.de>
Sat, 17 Nov 2018 18:10:46 +0000 (19:10 +0100)
committerGitHub <noreply@github.com>
Sat, 17 Nov 2018 18:10:46 +0000 (19:10 +0100)
indent/python.vim
spec/indent/indent_spec.rb

index 55b2b1bca6729af7ff2b9d8d791e2c552aef581b..6f846371c218beca24a0184d0bdbddb196a757d7 100644 (file)
@@ -313,7 +313,7 @@ function! s:indent_like_previous_line(lnum)
         return -1
     endif
 
-    if !empty && s:is_dedented_already(current, base)
+    if (current || !empty) && s:is_dedented_already(current, base)
         return -1
     endif
 
index 400ec1154b15a09505604aee4843b8cd7d779693..aa796df2316a02fd34cd6c412086e6bda2bd784d 100644 (file)
@@ -685,3 +685,22 @@ describe "Compact multiline dict" do
     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