From d1831744d69ff459c2a9bc1f81e470f53f90e763 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 30 Oct 2012 09:12:48 +0900 Subject: [PATCH] - Fixed expand snippet. --- autoload/neosnippet.vim | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index fefae41..8b1d3ae 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -170,6 +170,14 @@ function! s:set_snippet_dict(snippet_dict, snippets, dup_check, snippets_file)"{ return endif + " Substitute word. + let a:snippet_dict.word = substitute(a:snippet_dict.word, '\n$', '', '') + if a:snippet_dict.word !~ + \ s:get_placeholder_marker_substitute_pattern() + " Add placeholder. + let a:snippet_dict.word .= '${0}' + endif + let action_pattern = '^snippet\s\+' . a:snippet_dict.name . '$' let snippet = s:initialize_snippet( \ a:snippet_dict, a:snippets_file, @@ -416,12 +424,6 @@ function! s:parse_snippets_file(snippets, snippets_file)"{{{ endfor if !empty(snippet_dict) - if snippet_dict.word !~ - \ s:get_placeholder_marker_substitute_pattern() - " Add placeholder. - let snippet_dict.word .= '${0}' - endif - " Set previous snippet. call s:set_snippet_dict(snippet_dict, \ a:snippets, dup_check, a:snippets_file) @@ -594,12 +596,6 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{ \ 'holder_cnt' : 1, \ }) - if next_line != '' - startinsert - else - startinsert! - endif - if snip_word =~ s:get_placeholder_marker_pattern() call neosnippet#jump(a:cur_text, a:col) endif