aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2016-03-11 13:28:51 +0900
committermattn <mattn.jp@gmail.com>2016-03-11 13:28:51 +0900
commitd829994fc2ceda16489c7de51efb627003e0b3f2 (patch)
tree94fd0ce4da1154006d25c5bdfb6f9925d0746112
parent0965a8eee6297a9c2388b0162a837f390be3965d (diff)
parent97919c865a5b81b9a0c124fee3a2b0756a4d593c (diff)
downloadvim-sonictemplate-d829994fc2ceda16489c7de51efb627003e0b3f2.tar.gz
vim-sonictemplate-d829994fc2ceda16489c7de51efb627003e0b3f2.tar.bz2
vim-sonictemplate-d829994fc2ceda16489c7de51efb627003e0b3f2.zip
Merge pull request #23 from sgur/shiftwidth
Fix for noexpandtab && &sw == 0 && &ts != &sw
-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('$')