From e25014e00884c56142f34f204aca595814a2895f Mon Sep 17 00:00:00 2001 From: Vinson Chuong Date: Thu, 25 Oct 2012 07:56:08 -0700 Subject: [PATCH] Prevent folding of expanded snippet --- autoload/neosnippet.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index b12095c..03e7e9e 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -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