From d6fcbb8a3e94a1d9036349536c0689afced4eff7 Mon Sep 17 00:00:00 2001 From: mattn Date: Thu, 27 Oct 2011 21:31:33 +0900 Subject: fix cursor. --- plugin/template.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/template.vim b/plugin/template.vim index 8bd3a4f..391e17a 100644 --- a/plugin/template.vim +++ b/plugin/template.vim @@ -83,8 +83,8 @@ function! s:Template(name) let c = c[:-2] endif let line = getline('.') - let indent = substitute(line, '^\(\s*\)', '\1', '') - if line =~ '^\s*$' + let indent = matchstr(line, '^\(\s*\)') + if line =~ '^\s*$' && line('.') != line('$') silent! normal dd endif let c = indent . substitute(c, "\n", "\n".indent, 'g') @@ -96,6 +96,7 @@ function! s:Template(name) if stridx(c, '{{_cursor_}}') silent! call search('{{_cursor_}}', 'w') silent! s/{{_cursor_}}//g + silent! exe "normal! \" endif endif endfunction -- cgit v1.2.3-54-g00ecf