aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2011-10-27 21:31:33 +0900
committermattn <mattn.jp@gmail.com>2011-10-27 21:31:33 +0900
commitd6fcbb8a3e94a1d9036349536c0689afced4eff7 (patch)
treed79974a59c80f4add26c4cad1b7aeb16c018eaeb /plugin
parent4a63f595d790d3b853322a7c588aac3767769b00 (diff)
downloadvim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.tar.gz
vim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.tar.bz2
vim-sonictemplate-d6fcbb8a3e94a1d9036349536c0689afced4eff7.zip
fix cursor.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/template.vim5
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