diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2016-05-02 10:42:37 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2016-05-02 10:42:37 +0200 | 
| commit | 5dd1a7e83966c92d220073185f1738dfe441f59e (patch) | |
| tree | 9c4bee389a51a9bb111dcc894c9db0f6d1809d81 /indent/cucumber.vim | |
| parent | bc098370c1bb81840734f5764f431dee270e75ce (diff) | |
| download | vim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.tar.gz vim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.zip | |
Update
Diffstat (limited to 'indent/cucumber.vim')
| -rw-r--r-- | indent/cucumber.vim | 19 | 
1 files changed, 10 insertions, 9 deletions
| diff --git a/indent/cucumber.vim b/indent/cucumber.vim index 5e646a51..03f11dc8 100644 --- a/indent/cucumber.vim +++ b/indent/cucumber.vim @@ -29,6 +29,7 @@ function! GetCucumberIndent()    let line  = getline(prevnonblank(v:lnum-1))    let cline = getline(v:lnum)    let nline = getline(nextnonblank(v:lnum+1)) +  let sw = exists('*shiftwidth') ? shiftwidth() : &sw    let syn = s:syn(prevnonblank(v:lnum-1))    let csyn = s:syn(v:lnum)    let nsyn = s:syn(nextnonblank(v:lnum+1)) @@ -37,38 +38,38 @@ function! GetCucumberIndent()      return 0    elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'      " examples heading -    return 2 * &sw +    return 2 * sw    elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'      " background, scenario or outline heading -    return &sw +    return sw    elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'      " line after feature heading -    return &sw +    return sw    elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'      " line after examples heading -    return 3 * &sw +    return 3 * sw    elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'      " line after background, scenario or outline heading -    return 2 * &sw +    return 2 * sw    elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)      " tag or comment before a feature heading      return 0    elseif cline =~# '^\s*@'      " other tags -    return &sw +    return sw    elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'      " mid-table      " preserve indent      return indent(prevnonblank(v:lnum-1))    elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'      " first line of a table, relative indent -    return indent(prevnonblank(v:lnum-1)) + &sw +    return indent(prevnonblank(v:lnum-1)) + sw    elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'      " line after a table, relative unindent -    return indent(prevnonblank(v:lnum-1)) - &sw +    return indent(prevnonblank(v:lnum-1)) - sw    elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')      " comments on scenarios -    return &sw +    return sw    endif    return indent(prevnonblank(v:lnum-1))  endfunction | 
