From 97919c865a5b81b9a0c124fee3a2b0756a4d593c Mon Sep 17 00:00:00 2001 From: sgur Date: Fri, 11 Mar 2016 10:44:09 +0900 Subject: Fix for &noet && &sw == 0 && &ts != &sw Check &sw!=0 for tab expantion --- autoload/sonictemplate.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim index de61a07..dc4f33a 100644 --- a/autoload/sonictemplate.vim +++ b/autoload/sonictemplate.vim @@ -266,7 +266,7 @@ function! sonictemplate#apply(name, mode, ...) abort if !buffer_is_not_empty let c = substitute(c, '{{_inline_}}\s*', '', 'g') - if &expandtab || &tabstop != &shiftwidth + if &expandtab || (&shiftwidth && &tabstop != &shiftwidth) let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g') endif silent! %d _ @@ -291,9 +291,9 @@ function! sonictemplate#apply(name, mode, ...) abort let c = lhs . c . rhs endif let c = indent . substitute(substitute(c, "\n", "\n".indent, 'g'), "\n".indent."\n", "\n\n", 'g') - if len(indent) && (&expandtab || &tabstop != &shiftwidth || indent =~ '^ \+$') + if len(indent) && (&expandtab || (&shiftwidth && &tabstop != &shiftwidth) || indent =~ '^ \+$') let c = substitute(c, "\t", repeat(' ', min([len(indent), &shiftwidth])), 'g') - elseif &expandtab || &tabstop != &shiftwidth + elseif &expandtab || (&shiftwidth && &tabstop != &shiftwidth) let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g') endif if line('.') < line('$') -- cgit v1.2.3-54-g00ecf