From aa0bc464fa2d997f6a100a1790c96873c4c4f404 Mon Sep 17 00:00:00 2001 From: Vinson Chuong Date: Thu, 25 Oct 2012 22:43:28 -0700 Subject: [PATCH] Simplify folding fix --- autoload/neosnippet.vim | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 03e7e9e..a42c1cd 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -549,11 +549,6 @@ 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) @@ -572,6 +567,10 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{ call append('.', snippet_lines[1:]) endif + if has('folding') + silent! execute begin_line . ',' . end_line . 'foldopen!' + endif + call s:indent_snippet(begin_line, end_line) let begin_patterns = (begin_line > 1) ? @@ -592,11 +591,6 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{ 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