From fef60dbe6ceea3d5786e7c74f4e1c216de170011 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 19 Dec 2015 12:27:49 +0900 Subject: [PATCH] Improve auto placeholder feature --- autoload/neosnippet.vim | 3 +++ autoload/neosnippet/parser.vim | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index f1aeec9..5e6d6a6 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -86,6 +86,9 @@ endfunction"}}} function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() "{{{ return '\${\([1-9]\d*\%(:.\{-}\)\?\\\@' endfunction"}}} diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index 4369ef3..c3c4cbd 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -238,6 +238,14 @@ endfunction"}}} function! neosnippet#parser#_initialize_snippet(dict, path, line, pattern, name) "{{{ let a:dict.word = substitute(a:dict.word, '\n\+$', '', '') + if a:dict.word !~ '\n' + \ && a:dict.word !~ + \ neosnippet#get_placeholder_marker_substitute_pattern().'$' + \ && a:dict.word !~ + \ neosnippet#get_placeholder_marker_substitute_zero_pattern() + " Add placeholder. + let a:dict.word .= '${0}' + endif if !has_key(a:dict, 'abbr') || a:dict.abbr == '' " Set default abbr.