aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorsgur <sgurrr@gmail.com>2016-03-11 10:44:09 +0900
committersgur <sgurrr@gmail.com>2016-03-11 10:44:09 +0900
commit97919c865a5b81b9a0c124fee3a2b0756a4d593c (patch)
tree94fd0ce4da1154006d25c5bdfb6f9925d0746112 /autoload
parent0965a8eee6297a9c2388b0162a837f390be3965d (diff)
downloadvim-sonictemplate-97919c865a5b81b9a0c124fee3a2b0756a4d593c.tar.gz
vim-sonictemplate-97919c865a5b81b9a0c124fee3a2b0756a4d593c.tar.bz2
vim-sonictemplate-97919c865a5b81b9a0c124fee3a2b0756a4d593c.zip
Fix for &noet && &sw == 0 && &ts != &sw
Check &sw!=0 for tab expantion
Diffstat (limited to 'autoload')
-rw-r--r--autoload/sonictemplate.vim6
1 files 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('$')