diff options
author | mattn <mattn.jp@gmail.com> | 2011-10-28 10:22:20 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2011-10-28 10:22:20 +0900 |
commit | 65d61396541c563ede37de7abd052453af5e5648 (patch) | |
tree | 9cb7c84592e8524f73f54e7d3a4913b255c536e2 /plugin | |
parent | cb98d68e685247afe5ce09a9da734acda9669875 (diff) | |
download | vim-sonictemplate-65d61396541c563ede37de7abd052453af5e5648.tar.gz vim-sonictemplate-65d61396541c563ede37de7abd052453af5e5648.tar.bz2 vim-sonictemplate-65d61396541c563ede37de7abd052453af5e5648.zip |
add {{_if_:foo;bar;baz}}.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/template.vim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugin/template.vim b/plugin/template.vim index a6cbc59..dd742a5 100644 --- a/plugin/template.vim +++ b/plugin/template.vim @@ -70,6 +70,7 @@ function! s:Template(name) abort let val = input(var . ":") let c = substitute(c, '\V{{_input_:'.var.'}}', '\=val', 'g') endfor + let c = substitute(c, '{{_if_:\(.\{-}\);\(.\{-}\)\(;\(.\{-}\)\)\{-}}}', '\=eval(submatch(1))?submatch(2):submatch(4)', 'g') let c = substitute(c, '{{_expr_:\(.\{-}\)}}', '\=eval(submatch(1))', 'g') if len(c) == 0 return @@ -96,8 +97,9 @@ function! s:Template(name) abort if stridx(c, '{{_cursor_}}') silent! call search('{{_cursor_}}', 'w') silent! s/{{_cursor_}}//g - silent! exe "normal! \<c-o>" endif + silent! exe "normal! \<c-o>" + startinsert endfunction " vim:ts=4:sw=4:et |