aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2019-09-26 14:28:34 +0900
committerGitHub <noreply@github.com>2019-09-26 14:28:34 +0900
commit39cf197d0e46eeff8f905063ba5030e8690169b3 (patch)
treefb1e62fd15393052b3aa5eb73cb019d4842a9b86
parentdf88ac36ed24e68d7d9d7e4d9aa471575d3c79bd (diff)
parent2f49560db7699d7988a817a4f69f8b684cecdfee (diff)
downloadvim-sonictemplate-39cf197d0e46eeff8f905063ba5030e8690169b3.tar.gz
vim-sonictemplate-39cf197d0e46eeff8f905063ba5030e8690169b3.tar.bz2
vim-sonictemplate-39cf197d0e46eeff8f905063ba5030e8690169b3.zip
Merge pull request #34 from hiroebe/fix-shiftwidth
Use shiftwidth() instead of &shiftwidth
-rw-r--r--autoload/sonictemplate.vim10
1 files changed, 5 insertions, 5 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim
index 9397efa..1fc6451 100644
--- a/autoload/sonictemplate.vim
+++ b/autoload/sonictemplate.vim
@@ -281,7 +281,7 @@ function! sonictemplate#apply(name, mode, ...) abort
if !buffer_is_not_empty
let c = substitute(c, '{{_inline_}}\s*', '', 'g')
if &expandtab || (&shiftwidth && &tabstop != &shiftwidth)
- let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g')
+ let c = substitute(c, "\t", repeat(' ', shiftwidth()), 'g')
endif
silent! %d _
silent! put = c
@@ -309,9 +309,9 @@ function! sonictemplate#apply(name, mode, ...) abort
endif
let c = indent . substitute(substitute(c, "\n", "\n".indent, 'g'), "\n".indent."\n", "\n\n", 'g')
if len(indent) && (&expandtab || (&shiftwidth && &tabstop != &shiftwidth) || indent =~ '^ \+$')
- let c = substitute(c, "\t", repeat(' ', min([len(indent), &shiftwidth])), 'g')
+ let c = substitute(c, "\t", repeat(' ', min([len(indent), shiftwidth()])), 'g')
elseif &expandtab || (&shiftwidth && &tabstop != &shiftwidth)
- let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g')
+ let c = substitute(c, "\t", repeat(' ', shiftwidth()), 'g')
endif
if line('.') < line('$')
silent! normal! dd
@@ -360,9 +360,9 @@ function! sonictemplate#postfix()
if c =~ "\n"
let c = indent . substitute(substitute(c, "\n", "\n".indent, 'g'), "\n".indent."\n", "\n\n", 'g')
if len(indent) && (&expandtab || (&shiftwidth && &tabstop != &shiftwidth) || indent =~ '^ \+$')
- let c = substitute(c, "\t", repeat(' ', min([len(indent), &shiftwidth])), 'g')
+ let c = substitute(c, "\t", repeat(' ', min([len(indent), shiftwidth()])), 'g')
elseif &expandtab || (&shiftwidth && &tabstop != &shiftwidth)
- let c = substitute(c, "\t", repeat(' ', &shiftwidth), 'g')
+ let c = substitute(c, "\t", repeat(' ', shiftwidth()), 'g')
endif
call setline('.', line)
if line('.') < line('$')