aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2011-10-27 19:15:10 +0900
committermattn <mattn.jp@gmail.com>2011-10-27 19:15:10 +0900
commit1e0f6520ba3bf30bc6bf43f0858855d8ce90d22f (patch)
treee31ff192f6848da00fab1bc8723f08f95d33ec92
parent783f7e7203b4382b9bf868a1c5ce5998da6b0302 (diff)
downloadvim-sonictemplate-1e0f6520ba3bf30bc6bf43f0858855d8ce90d22f.tar.gz
vim-sonictemplate-1e0f6520ba3bf30bc6bf43f0858855d8ce90d22f.tar.bz2
vim-sonictemplate-1e0f6520ba3bf30bc6bf43f0858855d8ce90d22f.zip
intelligent indent.
-rw-r--r--plugin/template.vim3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugin/template.vim b/plugin/template.vim
index 336c2a6..f200e74 100644
--- a/plugin/template.vim
+++ b/plugin/template.vim
@@ -84,6 +84,9 @@ function! s:Template(name)
silent! normal dd
endif
let c = indent . substitute(c, "\n", "\n".indent, 'g')
+ if &expandtab || indent =~ '^ *$'
+ let c = substitute(c, "\t", repeat(' ', min([len(indent), &tabstop])), 'g')
+ endif
silent! put! = c
endif
if stridx(c, '{{_cursor_}}')