- Fixed errors.
This commit is contained in:
parent
4b24e4bc2f
commit
7e442e9a68
@ -639,7 +639,7 @@ function! s:snippets_force_jump(cur_text, col)"{{{
|
|||||||
return 0
|
return 0
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:search_snippet_range(start, end)"{{{
|
function! s:search_snippet_range(start, end)"{{{
|
||||||
call s:substitute_marker(a:start, a:end)
|
call s:substitute_placeholder_marker(a:start, a:end)
|
||||||
|
|
||||||
let pattern = substitute(s:get_placeholder_marker_pattern(),
|
let pattern = substitute(s:get_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', s:snippet_holder_cnt, '')
|
\ '\\d\\+', s:snippet_holder_cnt, '')
|
||||||
@ -658,7 +658,7 @@ function! s:search_snippet_range(start, end)"{{{
|
|||||||
return 0
|
return 0
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:search_outof_range(col)"{{{
|
function! s:search_outof_range(col)"{{{
|
||||||
call s:substitute_marker(1, 0)
|
call s:substitute_placeholder_marker(1, 0)
|
||||||
|
|
||||||
let pattern = s:get_placeholder_marker_pattern()
|
let pattern = s:get_placeholder_marker_pattern()
|
||||||
if search(pattern, 'w') > 0
|
if search(pattern, 'w') > 0
|
||||||
@ -704,8 +704,8 @@ function! s:expand_placeholder(start, end, holder_cnt, line)"{{{
|
|||||||
let pattern = substitute(s:get_placeholder_marker_pattern(),
|
let pattern = substitute(s:get_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', cnt, '')
|
\ '\\d\\+', cnt, '')
|
||||||
call setline(a:line, substitute(current_line, pattern,
|
call setline(a:line, substitute(current_line, pattern,
|
||||||
\ '\$<'.cnt.':'.escape(default, '\').'>', ''))
|
\ '<{'.cnt.':'.escape(default, '\').'}>', ''))
|
||||||
let pos[2] += len('$<'.cnt.':')
|
let pos[2] += len('<{'.cnt.':')
|
||||||
else
|
else
|
||||||
" Substitute holder.
|
" Substitute holder.
|
||||||
call setline(a:line,
|
call setline(a:line,
|
||||||
@ -750,42 +750,38 @@ function! s:search_sync_placeholder(start, end, number)"{{{
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:substitute_marker(start, end)"{{{
|
function! s:substitute_placeholder_marker(start, end)"{{{
|
||||||
if s:snippet_holder_cnt > 1
|
if s:snippet_holder_cnt > 1
|
||||||
let cnt = s:snippet_holder_cnt-1
|
let cnt = s:snippet_holder_cnt-1
|
||||||
let marker = substitute(s:get_sync_placeholder_marker_pattern(),
|
let marker = substitute(s:get_sync_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', cnt, '')
|
\ '\\d\\+', cnt, '')
|
||||||
let line = a:start
|
let line = a:start
|
||||||
while line <= a:end
|
|
||||||
|
for line in range(a:start, a:end)
|
||||||
if getline(line) =~ marker
|
if getline(line) =~ marker
|
||||||
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/' . substitute(
|
silent execute printf('%d,%ds/' . substitute(
|
||||||
\ s:get_mirror_placeholder_marker_pattern()
|
\ s:get_mirror_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', cnt, '') . '/%s/'
|
\ '\\d\\+', cnt, '') . '/%s/'
|
||||||
\ . (&gdefault ? '' : 'g'), a:start, a:end, sub)
|
\ . (&gdefault ? '' : 'g'), a:start, a:end, sub)
|
||||||
silent! execute line.'s/'.marker.'/'.sub.'/'
|
call setline(line, substitute(getline('.'), marker, sub, 'g'))
|
||||||
\ . (&gdefault ? 'g' : '')
|
|
||||||
break
|
|
||||||
endif
|
endif
|
||||||
|
endfor
|
||||||
let line += 1
|
|
||||||
endwhile
|
|
||||||
elseif search(s:get_sync_placeholder_marker_pattern(), 'wb') > 0
|
elseif search(s:get_sync_placeholder_marker_pattern(), 'wb') > 0
|
||||||
let sub = escape(matchstr(getline('.'),
|
let sub = escape(matchstr(getline('.'),
|
||||||
\ s:get_sync_placeholder_marker_default_pattern()), '/\')
|
\ s:get_sync_placeholder_marker_default_pattern()), '/\')
|
||||||
let cnt = matchstr(getline('.'),
|
let cnt = matchstr(getline('.'),
|
||||||
\ substitute(s:get_sync_placeholder_marker_pattern(),
|
\ substitute(s:get_sync_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
|
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
|
||||||
silent! execute printf('%%s/' . substitute(
|
silent execute printf('%%s/' . substitute(
|
||||||
\ s:get_mirror_placeholder_marker_pattern()
|
\ s:get_mirror_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', cnt, '') . '/%s/'
|
\ '\\d\\+', cnt, '') . '/%s/'
|
||||||
\ . (&gdefault ? 'g' : ''), sub)
|
\ . (&gdefault ? 'g' : ''), sub)
|
||||||
let marker = substitute(s:get_sync_placeholder_marker_pattern(),
|
let marker = substitute(s:get_sync_placeholder_marker_pattern(),
|
||||||
\ '\\d\\+', cnt, '')
|
\ '\\d\\+', cnt, '')
|
||||||
silent! execute '%s/'.marker.'/'.sub.'/'
|
call setline('.', substitute(getline('.'), marker, sub, 'g'))
|
||||||
\ . (&gdefault ? 'g' : '')
|
|
||||||
endif
|
endif
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:trigger(function)"{{{
|
function! s:trigger(function)"{{{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
*neocomplcache-snippets-complete-snippets-complete.txt*
|
*neocomplcache-snippets-complete-snippets-complete.txt*
|
||||||
neocomplcache complete snippets source
|
neocomplcache complete snippets source
|
||||||
|
|
||||||
Version: 1.0
|
Version: 2.0
|
||||||
Author : Shougo <Shougo.Matsu@gmail.com>
|
Author : Shougo <Shougo.Matsu@gmail.com>
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user