aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorShintaro Kaneko <kaneshin0120@gmail.com>2012-06-27 08:33:27 +0900
committerShintaro Kaneko <kaneshin0120@gmail.com>2012-06-27 08:33:27 +0900
commitec8849ff37be7bc6046416611ef83bef33fb348f (patch)
treeca8634d40ac8d3ea644f2c0055a2058fb68f2287 /autoload
parent052bb7cb5e138e91480efbb3a81c12b143d505ce (diff)
downloadvim-sonictemplate-ec8849ff37be7bc6046416611ef83bef33fb348f.tar.gz
vim-sonictemplate-ec8849ff37be7bc6046416611ef83bef33fb348f.tar.bz2
vim-sonictemplate-ec8849ff37be7bc6046416611ef83bef33fb348f.zip
Fix expandtab if the length of 'indent' is zero.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/sonictemplate.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim
index 41093fc..13c1651 100644
--- a/autoload/sonictemplate.vim
+++ b/autoload/sonictemplate.vim
@@ -1,7 +1,7 @@
"=============================================================================
" sonictemplate.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 11-Jun-2012.
+" Last Change: 27-Jun-2012.
let s:save_cpo = &cpo
set cpo&vim
@@ -164,6 +164,8 @@ function! sonictemplate#apply(name, mode, ...) abort
let c = indent . substitute(substitute(c, "\n", "\n".indent, 'g'), "\n".indent."\n", "\n\n", 'g')
if len(indent) && (&expandtab || &tabstop != &shiftwidth || indent =~ '^ \+$')
let c = substitute(c, "\t", repeat(' ', min([len(indent), &shiftwidth])), 'g')
+ elseif &expandtab || &tabstop != &shiftwidth
+ let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g')
endif
silent! put! =c
endif