- Improved expand behavior.

This commit is contained in:
Shougo Matsushita 2012-10-28 18:58:55 +09:00
parent 77375e8fd3
commit 6f2f181cb3
3 changed files with 42 additions and 28 deletions

View File

@ -575,6 +575,7 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
let &l:foldmethod = 'manual' let &l:foldmethod = 'manual'
endif endif
try
call setline('.', snippet_lines[0]) call setline('.', snippet_lines[0])
if len(snippet_lines) > 1 if len(snippet_lines) > 1
call append('.', snippet_lines[1:]) call append('.', snippet_lines[1:])
@ -603,11 +604,13 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
if snip_word =~ s:get_placeholder_marker_pattern() if snip_word =~ s:get_placeholder_marker_pattern()
call s:snippets_jump(a:cur_text, a:col) call s:snippets_jump(a:cur_text, a:col)
endif endif
finally
if has('folding') if has('folding')
let &l:foldmethod = foldmethod let &l:foldmethod = foldmethod
silent! execute begin_line . ',' . end_line . 'foldopen!' silent! execute begin_line . ',' . end_line . 'foldopen!'
endif endif
endtry
let &l:iminsert = 0 let &l:iminsert = 0
let &l:imsearch = 0 let &l:imsearch = 0
endfunction"}}} endfunction"}}}

View File

@ -50,6 +50,16 @@ options head
${3} ${3}
endtry endtry
snippet tryfinally
abbr try ... finally ... endtry
alias tryf
options head
try
${1}
finally
${2}
endtry
snippet catch snippet catch
options head options head
catch ${1:/${2:pattern: empty, E484, Vim(cmdname):{errmsg\\}\}/} catch ${1:/${2:pattern: empty, E484, Vim(cmdname):{errmsg\\}\}/}

View File

@ -456,6 +456,7 @@ CHANGELOG *neosnippet-changelog*
2012-10-28 2012-10-28
- Improved snipMate compatibility. - Improved snipMate compatibility.
- Improved expand behavior.
2012-10-27 2012-10-27
- Fixed for :SnippetEdit. - Fixed for :SnippetEdit.