- Changed marker patterns.

This commit is contained in:
Shougo Matsushita 2012-03-14 09:43:33 +09:00
parent 7f78cba880
commit 4b24e4bc2f
2 changed files with 16 additions and 7 deletions

View File

@ -548,6 +548,14 @@ function! neocomplcache#sources#snippets_complete#expand(cur_text, col, trigger_
" Substitute escaped `. " Substitute escaped `.
let snip_word = substitute(snip_word, '\\`', '`', 'g') let snip_word = substitute(snip_word, '\\`', '`', 'g')
" Substitute markers.
let snip_word = substitute(snip_word,
\ s:get_placeholder_marker_substitute_pattern(),
\ '<`\1`>', 'g')
let snip_word = substitute(snip_word,
\ s:get_mirror_placeholder_marker_substitute_pattern(),
\ '<|\1|>', 'g')
" Insert snippets. " Insert snippets.
let next_line = getline('.')[a:col-1 :] let next_line = getline('.')[a:col-1 :]
let snippet_lines = split(snip_word, '\n', 1) let snippet_lines = split(snip_word, '\n', 1)
@ -820,25 +828,25 @@ function! neocomplcache#sources#snippets_complete#get_snippets()"{{{
endfunction"}}} endfunction"}}}
function! s:get_placeholder_marker_pattern()"{{{ function! s:get_placeholder_marker_pattern()"{{{
return '\${\d\+\%(:.\{-}\)\?\\\@<!}' return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
endfunction"}}} endfunction"}}}
function! s:get_placeholder_marker_substitute_pattern()"{{{ function! s:get_placeholder_marker_substitute_pattern()"{{{
return '\${\zs\d\+\%(:.\{-}\)\?\\\@<!\ze}' return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
endfunction"}}} endfunction"}}}
function! s:get_placeholder_marker_default_pattern()"{{{ function! s:get_placeholder_marker_default_pattern()"{{{
return '\${\d\+:\zs.\{-}\ze\\\@<!}' return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
endfunction"}}} endfunction"}}}
function! s:get_sync_placeholder_marker_pattern()"{{{ function! s:get_sync_placeholder_marker_pattern()"{{{
return '\$<\d\+\%(:.\{-}\)\?\\\@<!>' return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
endfunction"}}} endfunction"}}}
function! s:get_sync_placeholder_marker_default_pattern()"{{{ function! s:get_sync_placeholder_marker_default_pattern()"{{{
return '\$<\d\+:\zs.\{-}\ze\\\@<!>' return '<{\d\+:\zs.\{-}\ze\\\@<!}>'
endfunction"}}} endfunction"}}}
function! s:get_mirror_placeholder_marker_pattern()"{{{ function! s:get_mirror_placeholder_marker_pattern()"{{{
return '\$\d\+' return '<|\d\+|>'
endfunction"}}} endfunction"}}}
function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{ function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{
return '\$\zs\d\+\ze' return '\$\(\d\+\)'
endfunction"}}} endfunction"}}}
function! s:SID_PREFIX()"{{{ function! s:SID_PREFIX()"{{{
return matchstr(expand('<sfile>'), '<SNR>\d\+_') return matchstr(expand('<sfile>'), '<SNR>\d\+_')

View File

@ -299,6 +299,7 @@ CHANGELOG *neocomplcache-snippets-complete-changelog*
- Refactored expand snippet behavior. - Refactored expand snippet behavior.
- Fixed expand bug. - Fixed expand bug.
- Refactored substitute patterns. - Refactored substitute patterns.
- Changed marker patterns.
2012-03-08 2012-03-08
- Use shiftwidth instead of softabstop. - Use shiftwidth instead of softabstop.