From 69aec9b9b849403f47f766f62f03a30c10193eb7 Mon Sep 17 00:00:00 2001 From: Raphaela Wrede Date: Fri, 15 Aug 2014 13:20:30 +0200 Subject: [PATCH] improved indention for gherkin cucumber feature: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scenario: Change password Given a user exists with email: "john@doe.com" And I am signed in as the user When I go to the homepage And I follow "Mein Konto" instead of: Scenario: Change password Given a user exists with email: "john@doe.com" And I am signed in as the user When I go to the homepage And I follow "Mein Konto" And I follow "Mein Passwort ändern" --- indent/cucumber.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/indent/cucumber.vim b/indent/cucumber.vim index 965c778..8aa8dad 100644 --- a/indent/cucumber.vim +++ b/indent/cucumber.vim @@ -48,6 +48,16 @@ function! GetCucumberIndent() elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' " line after background, scenario or outline heading return 2 * &sw + elseif cline =~# '^\s*\%(And\|But\)' && line =~# '^\s*\%(When\|Then\)' + return indent(prevnonblank(v:lnum-1)) + 1 + elseif cline =~# '^\s*\%(And\|But\)' && line =~# '^\s*\%(Given\)' + return indent(prevnonblank(v:lnum-1)) + 2 + elseif cline =~# '^\s*\%(When\|Then\)' && line =~# '^\s*\%(Given\)' + return indent(prevnonblank(v:lnum-1)) + 1 + elseif cline =~# '^\s*\%(When\|Then\)' && line =~# '^\s*\%(And\|But\)' + return indent(prevnonblank(v:lnum-1)) - 1 + elseif cline =~# '^\s*\%(When\|Then\)' && line =~# '^\s*\%(When\|Then\)' + return indent(prevnonblank(v:lnum-1)) elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) " tag or comment before a feature heading return 0