diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index dff55b8..5365b51 100644 --- a/autoload/neocomplcache/sources/snippets_complete.vim +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -804,20 +804,21 @@ endfunction"}}} function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt)"{{{ if a:snippet_holder_cnt > 1 let cnt = a:snippet_holder_cnt-1 - let marker = substitute(s:get_sync_placeholder_marker_pattern(), + let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(), \ '\\d\\+', cnt, '') + let mirror_marker = substitute( + \ s:get_mirror_placeholder_marker_pattern(), + \ '\\d\\+', cnt, '') let line = a:start for line in range(a:start, a:end) - if getline(line) =~ marker + if getline(line) =~ sync_marker let sub = escape(matchstr(getline(line), \ substitute(s:get_sync_placeholder_marker_default_pattern(), \ '\\d\\+', cnt, '')), '/\') - silent execute printf('%d,%ds/' . substitute( - \ s:get_mirror_placeholder_marker_pattern(), - \ '\\d\\+', cnt, '') . '/%s/' - \ . (&gdefault ? '' : 'g'), a:start, a:end, sub) - call setline(line, substitute(getline('.'), marker, sub, 'g')) + silent execute printf('%d,%ds/' . mirror_marker . '/%s/' + \ . (&gdefault ? '' : 'g'), a:start, a:end, sub) + call setline(line, substitute(getline(line), sync_marker, sub, '')) endif endfor elseif search(s:get_sync_placeholder_marker_pattern(), 'wb') > 0 @@ -826,13 +827,14 @@ function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt)"{{{ let cnt = matchstr(getline('.'), \ substitute(s:get_sync_placeholder_marker_pattern(), \ '\\d\\+', '\\zs\\d\\+\\ze', '')) - silent execute printf('%%s/' . substitute( - \ s:get_mirror_placeholder_marker_pattern(), - \ '\\d\\+', cnt, '') . '/%s/' + silent execute printf('%%s/' . mirror_marker . '/%s/' \ . (&gdefault ? 'g' : ''), sub) - let marker = substitute(s:get_sync_placeholder_marker_pattern(), + let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(), \ '\\d\\+', cnt, '') - call setline('.', substitute(getline('.'), marker, sub, 'g')) + let mirror_marker = substitute( + \ s:get_mirror_placeholder_marker_pattern(), + \ '\\d\\+', cnt, '') + call setline('.', substitute(getline('.'), sync_marker, sub, '')) endif endfunction"}}} function! s:trigger(function)"{{{ diff --git a/doc/neocomplcache-snippets-complete.txt b/doc/neocomplcache-snippets-complete.txt index 890bdea..8a25cc7 100644 --- a/doc/neocomplcache-snippets-complete.txt +++ b/doc/neocomplcache-snippets-complete.txt @@ -295,6 +295,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet* ============================================================================== CHANGELOG *neocomplcache-snippets-complete-changelog* +2012-03-19 +- Fixed substitute marker. + 2012-03-18 - Fixed for expandtab.