Use shiftwidth() when available

Closes https://github.com/tpope/vim-haml/issues/76
This commit is contained in:
Tim Pope
2016-02-11 12:43:59 -05:00
parent 7d86692010
commit 1f2e47c78c
2 changed files with 4 additions and 3 deletions

View File

@@ -37,10 +37,11 @@ function! GetHamlIndent()
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
if cline =~# '\v^-\s*%(elsif|else|when)>'
let indent = cindent < indent ? cindent : indent - &sw
let indent = cindent < indent ? cindent : indent - sw
endif
let increase = indent + &sw
let increase = indent + sw
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif