Merge pull request #56 from vinsonchuong/fix-folding

Prevent folding of expanded snippet
This commit is contained in:
Shougo 2012-10-25 18:47:25 -07:00
commit d94e807286
1 changed files with 10 additions and 4 deletions

View File

@ -549,6 +549,11 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
\ '<|\1|>', 'g')
" Insert snippets.
if has('folding')
let foldmethod = &l:foldmethod
let &l:foldmethod = 'manual'
endif
let next_line = getline('.')[a:col-1 :]
let snippet_lines = split(snip_word, '\n', 1)
if empty(snippet_lines)
@ -581,16 +586,17 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
\ 'holder_cnt' : 1,
\ })
if has('folding') && foldclosed(line('.'))
" Open fold.
silent! normal! zO
endif
if next_col < col('$')
startinsert
else
startinsert!
endif
if has('folding')
let &l:foldmethod = foldmethod
silent execute begin_line . ',' . end_line . 'foldopen!'
endif
if snip_word =~ s:get_placeholder_marker_pattern()
call s:snippets_jump(a:cur_text, a:col)
endif