diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2016-07-01 19:12:11 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2016-07-01 19:12:11 +0900 |
commit | 249a9b048db8e2666549c6eda59a23ddf2d423b9 (patch) | |
tree | 45bb8ba58d477a5ca32820bb1bf89e9c0f63a76b | |
parent | db8a596b826a76e5731c7b30c8c97c92a84dad4c (diff) | |
download | vim-sonictemplate-249a9b048db8e2666549c6eda59a23ddf2d423b9.tar.gz vim-sonictemplate-249a9b048db8e2666549c6eda59a23ddf2d423b9.tar.bz2 vim-sonictemplate-249a9b048db8e2666549c6eda59a23ddf2d423b9.zip |
replace tabs
-rw-r--r-- | autoload/sonictemplate.vim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim index 72e5104..d0cfdd9 100644 --- a/autoload/sonictemplate.vim +++ b/autoload/sonictemplate.vim @@ -331,8 +331,13 @@ function! sonictemplate#pattern() for i in range(1, 9) let c = substitute(c, '{{$' . i . '}}', ml[i], 'g') endfor + let indent = matchstr(line, '^\(\s*\)') + if len(indent) && (&expandtab || (&shiftwidth && &tabstop != &shiftwidth) || indent =~ '^ \+$') + let c = substitute(c, "\t", repeat(' ', min([len(indent), &shiftwidth])), 'g') + elseif &expandtab || (&shiftwidth && &tabstop != &shiftwidth) + let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g') + endif if line !~ '^\s*$' - let indent = matchstr(line, '^\(\s*\)') let lhs = col('.') > 1 ? line[:col('.')-2] : '' let rhs = line[len(lhs):] let lhs = lhs[len(indent):] |