diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index bb2248d..9efd6fb 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" Last Modified: 10 Mar 2013. +" Last Modified: 02 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -557,11 +557,15 @@ function! neosnippet#expand(cur_text, col, trigger_name) "{{{ " Substitute markers. let snip_word = substitute(snip_word, - \ s:get_placeholder_marker_substitute_pattern(), + \ '\\\@', 'g') let snip_word = substitute(snip_word, - \ s:get_mirror_placeholder_marker_substitute_pattern(), + \ '\\\@', 'g') + let snip_word = substitute(snip_word, + \ '\\'.s:get_mirror_placeholder_marker_substitute_pattern().'\|'. + \ '\\'.s:get_placeholder_marker_substitute_pattern(), + \ '\=submatch(0)[1:]', 'g') " Insert snippets. let next_line = getline('.')[a:col-1 :] diff --git a/autoload/neosnippet/snippets/ruby.snip b/autoload/neosnippet/snippets/ruby.snip index 7c06441..84f192c 100644 --- a/autoload/neosnippet/snippets/ruby.snip +++ b/autoload/neosnippet/snippets/ruby.snip @@ -115,7 +115,6 @@ options word snippet main options head - if __FILE__ == $ 0 + if __FILE__ == \$0 ${1:TARGET} end -# the space is necessary unfortunately.. diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index fb7d50a..52021b3 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -542,7 +542,7 @@ The structure of a placeholder can be: > snippet namespace namespace ${1:name} { - ${0} + ${0} } // namespace $1 < @@ -555,6 +555,13 @@ special meaning to neosnippet you need to escape them with a backslash. snippet test ${1:escape \} value} + + # Substitute "\$0" to "$0" + snippet main + options head + if __FILE__ == \$0 + ${1:TARGET} + end < A placeholder value can not contain new lines. The snippet below isn't valid. @@ -756,6 +763,9 @@ A: ============================================================================== CHANGELOG *neosnippet-changelog* +2013-04-02 +- Improved escape placeholder behavior. + 2013-03-30 - Added rst snippets. - Added g:neosnippet#enable_preview option. diff --git a/syntax/snippet.vim b/syntax/snippet.vim index 43dcdd1..3df71b0 100644 --- a/syntax/snippet.vim +++ b/syntax/snippet.vim @@ -38,9 +38,9 @@ syn region neosnippetString start=+"+ end=+"+ contained syn region neosnippetEval start=+\\\@