diff runtime/indent/cucumber.vim @ 10048:43efa4f5a8ea

commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 30 23:26:57 2016 +0200 Updated runtime files. Remove version checks for Vim older than 6.0.
author Christian Brabandt <cb@256bit.org>
date Tue, 30 Aug 2016 23:30:09 +0200
parents 2eb30f341e8d
children 63b0b7b79b25
line wrap: on
line diff
--- a/runtime/indent/cucumber.vim
+++ b/runtime/indent/cucumber.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Cucumber
 " Maintainer:	Tim Pope <vimNOSPAM@tpope.org>
-" Last Change:	2013 May 30
+" Last Change:	2016 Aug 29
 
 if exists("b:did_indent")
   finish
@@ -27,6 +27,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))
@@ -35,38 +36,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