From 52545221f6d12c3b0b3e9b719d8cc118499c0922 Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 10 Mar 2014 11:13:39 +0900 Subject: [PATCH] Save/restore cursor position for removing $cursor$. related issue #162 --- autoload/emmet.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index d8035ed..7c646be 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -643,16 +643,15 @@ function! emmet#expandAbbr(mode, abbr) range endif endif endif - if search('\$cursor\$', 'e') + if search('\ze\$cursor\$', 'e') let oldselection = &selection let &selection = 'inclusive' if foldclosed(line('.')) != -1 silent! foldopen endif - silent! exe "normal! v7h\"_s" - if col('.') == col('$') - call feedkeys('', 'n') - endif + let pos = emmet#util#getcurpos() + silent! s/\$cursor\$// + silent! call setpos('.', pos) let &selection = oldselection endif if g:emmet_debug > 1