aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormityu <mityu.email@gmail.com>2019-06-04 20:26:09 +0900
committermityu <mityu.email@gmail.com>2019-06-09 12:13:03 +0900
commit670e2e61d089bafacab4d3994578c58794307ef2 (patch)
tree30916a9d780da65a3e0ae771c024994fc4ccbc2b
parentc1c13949a145803995a29c2b7d50cd58e8642128 (diff)
downloadvim-sonictemplate-670e2e61d089bafacab4d3994578c58794307ef2.tar.gz
vim-sonictemplate-670e2e61d089bafacab4d3994578c58794307ef2.tar.bz2
vim-sonictemplate-670e2e61d089bafacab4d3994578c58794307ef2.zip
Update the method of removeing {{_cursor_}}
feedkeys() does only adding characters to the queue of key inputs.
-rw-r--r--autoload/sonictemplate.vim18
1 files changed, 6 insertions, 12 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim
index 9397efa..a7476f8 100644
--- a/autoload/sonictemplate.vim
+++ b/autoload/sonictemplate.vim
@@ -1,7 +1,7 @@
"=============================================================================
" sonictemplate.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 07-Mar-2019.
+" Last Change: 04-Jun-2019.
let s:save_cpo = &cpo
set cpo&vim
@@ -320,15 +320,9 @@ function! sonictemplate#apply(name, mode, ...) abort
endif
endif
if stridx(c, '{{_cursor_}}') != -1
- if a:mode == 'n'
- silent! call search('\zs{{_cursor_}}', 'w')
- silent! foldopen
- silent! normal! 12"_x
- else
- silent! call search('{{_cursor_}}\zs', 'w')
- silent! foldopen
- silent! call feedkeys(repeat("\<bs>", 12))
- endif
+ silent! call search('\zs{{_cursor_}}', 'w')
+ silent! foldopen
+ silent! normal! "_da}
endif
endfunction
@@ -377,9 +371,9 @@ function! sonictemplate#postfix()
let &indentexpr = oldindentexpr
endif
if stridx(c, '{{_cursor_}}') != -1
- silent! call search('{{_cursor_}}\zs', 'w')
+ silent! call search('\zs{{_cursor_}}', 'w')
silent! foldopen
- silent! call feedkeys(repeat("\<bs>", 12))
+ silent! normal! "_da}
endif
break
endif