- Fixed snippet substitution.

This commit is contained in:
Shougo Matsushita 2013-06-27 11:16:30 +09:00
parent 87a0450300
commit 6a49b0fd1d

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: neosnippet.vim " FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 25 Jun 2013. " Last Modified: 27 Jun 2013.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -940,7 +940,7 @@ function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt) "{{{
let sub = escape(matchstr(getline(line), let sub = escape(matchstr(getline(line),
\ substitute(s:get_sync_placeholder_marker_default_pattern(), \ substitute(s:get_sync_placeholder_marker_default_pattern(),
\ '\\d\\+', cnt, '')), '/\') \ '\\d\\+', cnt, '')), '/\')
silent execute printf('%d,%ds/\m' . mirror_marker . '/\m%s/' silent execute printf('%d,%ds/\m' . mirror_marker . '/%s/'
\ . (&gdefault ? '' : 'g'), a:start, a:end, sub) \ . (&gdefault ? '' : 'g'), a:start, a:end, sub)
call setline(line, substitute(getline(line), sync_marker, sub, '')) call setline(line, substitute(getline(line), sync_marker, sub, ''))
endif endif
@ -954,7 +954,7 @@ function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt) "{{{
let mirror_marker = substitute( let mirror_marker = substitute(
\ s:get_mirror_placeholder_marker_pattern(), \ s:get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '') \ '\\d\\+', cnt, '')
silent execute printf('%%s/\m' . mirror_marker . '/\m%s/' silent execute printf('%%s/\m' . mirror_marker . '/%s/'
\ . (&gdefault ? 'g' : ''), sub) \ . (&gdefault ? 'g' : ''), sub)
let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(), let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '') \ '\\d\\+', cnt, '')