From: Johann Klähn Date: Tue, 7 Jan 2014 16:28:46 +0000 (+0100) Subject: prevent ':' from indenting inside unfinished string X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/fa0f4802afec544c313f4590825dd48400539440?ds=inline;hp=-c prevent ':' from indenting inside unfinished string --- fa0f4802afec544c313f4590825dd48400539440 diff --git a/indent/python.vim b/indent/python.vim index 9b8e9b1..d86eabb 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -27,11 +27,10 @@ let s:block_rules = { let s:paren_pairs = ['()', '{}', '[]'] let s:control_statement = '^\s*\(if\|while\|with\|for\|except\)\>' let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' -if v:version >= 704 || (v:version == 703 && has('patch1037')) - let s:string_literal = '".\{-}\\\@1' + vim.echo('synIDattr(synID(line("."), col("."), 0), "name")' + ).downcase.should include 'string' + vim.feedkeys 'a\' + proposed_indent.should == 0 + indent.should == 0 + end + + it "does not dedent" do + vim.feedkeys 'iif True:\"test:\' + vim.echo('synIDattr(synID(line("."), col("."), 0), "name")' + ).downcase.should include 'string' + proposed_indent.should == shiftwidth + indent.should == shiftwidth + end + end + describe "when using simple control structures" do it "indents shiftwidth spaces" do vim.feedkeys 'iwhile True:\pass' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b1e82a1..022f65b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,6 +14,7 @@ Vimrunner::RSpec.configure do |config| # vim.add_plugin(plugin_path, 'indent/python.vim') vim.command "set rtp^=#{plugin_path}" + vim.command "runtime syntax/python.vim" vim.command "runtime indent/python.vim" vim