diff options
author | mattn <mattn.jp@gmail.com> | 2011-10-27 21:31:33 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2011-10-27 21:31:33 +0900 |
commit | d6fcbb8a3e94a1d9036349536c0689afced4eff7 (patch) | |
tree | d79974a59c80f4add26c4cad1b7aeb16c018eaeb | |
parent | 4a63f595d790d3b853322a7c588aac3767769b00 (diff) | |
download | vim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.tar.gz vim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.tar.bz2 vim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.zip |
fix cursor.
-rw-r--r-- | plugin/template.vim | 5 |
1 files changed, 3 insertions, 2 deletions
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! \<c-o>" endif endif endfunction |