]> 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:

Merge pull request #19 from kljohann/tests
authorHynek Schlawack <hs@ox.cx>
Sat, 9 Nov 2013 15:08:57 +0000 (07:08 -0800)
committerHynek Schlawack <hs@ox.cx>
Sat, 9 Nov 2013 15:08:57 +0000 (07:08 -0800)
Run test cases for different sets of settings

While we care only about 4 spaces, running it with both may uncover subtle bugs.

indent/python.vim
spec/indent/indent_spec.rb

index c632c7bebf7eeb8d1925b51c7d03835b82c99d76..4d1edc2310908c6cd2f36160c7349b6435a756e0 100644 (file)
@@ -3,7 +3,6 @@
 " Maintainer:       Hynek Schlawack <hs@ox.cx>
 " Prev Maintainer:  Eric Mc Sween <em@tomcom.de> (address invalid)
 " Original Author:  David Bustos <bustos@caltech.edu> (address invalid)
-" Last Change:      2012-06-21
 " License:          Public Domain
 
 " Only load this indent file when no other was loaded.
@@ -176,6 +175,12 @@ function! GetPythonPEPIndent(lnum)
 
     " If the previous line ended with a colon and is not a comment, indent
     " relative to statement start.
+    let pline = substitute(pline, '\\\\', '', 'g')
+    if v:version > 703 || (v:version == 703 && has('patch1037'))
+        let pline = substitute(pline, '".\{-}\\\@1<!"\|''.\{-}\\\@1<!''', '', 'g')
+    else
+        let pline = substitute(pline, '".\{-}\\\@<!"\|''.\{-}\\\@<!''', '', 'g')
+    endif
     if pline =~ '^[^#]*:\s*\(#.*\)\?$'
         return indent(sslnum) + &sw
     endif
index bd0d0d99567d722684d254865383c55492244eca..eb3c8a6feb44669f2f9b19a54a7d185939427a78 100644 (file)
@@ -67,6 +67,20 @@ shared_examples_for "vim" do
     end
   end
 
+  describe "when '#' is contained in a string that is followed by a colon" do
+    it "indents by one level" do
+        vim.feedkeys 'iif "some#thing" == "test":#test\<CR>pass'
+        indent.should == shiftwidth
+    end
+  end
+
+  describe "when '#' is not contained in a string and is followed by a colon" do
+    it "does not indent" do
+        vim.feedkeys 'iif "some#thing" == "test"#:test\<CR>'
+        indent.should == 0
+    end
+  end
+
   describe "when using simple control structures" do
       it "indents shiftwidth spaces" do
           vim.feedkeys 'iwhile True:\<CR>pass'