From 1f2e47c78c2faf90ff419c2f4e1241094844678c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 11 Feb 2016 12:43:59 -0500 Subject: [PATCH] Use shiftwidth() when available Closes https://github.com/tpope/vim-haml/issues/76 --- indent/haml.vim | 5 +++-- indent/sass.vim | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/indent/haml.vim b/indent/haml.vim index 710aefc..cfd30f1 100644 --- a/indent/haml.vim +++ b/indent/haml.vim @@ -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 diff --git a/indent/sass.vim b/indent/sass.vim index eb69111..d2e7a9a 100644 --- a/indent/sass.vim +++ b/indent/sass.vim @@ -29,7 +29,7 @@ function! GetSassIndent() let indent = indent(lnum) let cindent = indent(v:lnum) if line !~ s:property && line !~ s:extend && cline =~ s:property - return indent + &sw + return indent + (exists('*shiftwidth') ? shiftwidth() : &sw) else return -1 endif