- Improved escape placeholder behavior.
This commit is contained in:
parent
08d5f030fd
commit
9e38cd7b9c
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: neosnippet.vim
|
" FILE: neosnippet.vim
|
||||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||||
" Last Modified: 10 Mar 2013.
|
" Last Modified: 02 Apr 2013.
|
||||||
" License: MIT license {{{
|
" License: MIT license {{{
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining
|
" Permission is hereby granted, free of charge, to any person obtaining
|
||||||
" a copy of this software and associated documentation files (the
|
" a copy of this software and associated documentation files (the
|
||||||
@ -557,11 +557,15 @@ function! neosnippet#expand(cur_text, col, trigger_name) "{{{
|
|||||||
|
|
||||||
" Substitute markers.
|
" Substitute markers.
|
||||||
let snip_word = substitute(snip_word,
|
let snip_word = substitute(snip_word,
|
||||||
\ s:get_placeholder_marker_substitute_pattern(),
|
\ '\\\@<!'.s:get_placeholder_marker_substitute_pattern(),
|
||||||
\ '<`\1`>', 'g')
|
\ '<`\1`>', 'g')
|
||||||
let snip_word = substitute(snip_word,
|
let snip_word = substitute(snip_word,
|
||||||
\ s:get_mirror_placeholder_marker_substitute_pattern(),
|
\ '\\\@<!'.s:get_mirror_placeholder_marker_substitute_pattern(),
|
||||||
\ '<|\1|>', 'g')
|
\ '<|\1|>', '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.
|
" Insert snippets.
|
||||||
let next_line = getline('.')[a:col-1 :]
|
let next_line = getline('.')[a:col-1 :]
|
||||||
|
@ -115,7 +115,6 @@ options word
|
|||||||
|
|
||||||
snippet main
|
snippet main
|
||||||
options head
|
options head
|
||||||
if __FILE__ == $ 0
|
if __FILE__ == \$0
|
||||||
${1:TARGET}
|
${1:TARGET}
|
||||||
end
|
end
|
||||||
# the space is necessary unfortunately..
|
|
||||||
|
@ -542,7 +542,7 @@ The structure of a placeholder can be:
|
|||||||
>
|
>
|
||||||
snippet namespace
|
snippet namespace
|
||||||
namespace ${1:name} {
|
namespace ${1:name} {
|
||||||
${0}
|
${0}
|
||||||
} // namespace $1
|
} // namespace $1
|
||||||
<
|
<
|
||||||
|
|
||||||
@ -555,6 +555,13 @@ special meaning to neosnippet you need to escape them with a backslash.
|
|||||||
|
|
||||||
snippet test
|
snippet test
|
||||||
${1:escape \} value}
|
${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.
|
A placeholder value can not contain new lines. The snippet below isn't valid.
|
||||||
@ -756,6 +763,9 @@ A:
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
CHANGELOG *neosnippet-changelog*
|
CHANGELOG *neosnippet-changelog*
|
||||||
|
|
||||||
|
2013-04-02
|
||||||
|
- Improved escape placeholder behavior.
|
||||||
|
|
||||||
2013-03-30
|
2013-03-30
|
||||||
- Added rst snippets.
|
- Added rst snippets.
|
||||||
- Added g:neosnippet#enable_preview option.
|
- Added g:neosnippet#enable_preview option.
|
||||||
|
@ -38,9 +38,9 @@ syn region neosnippetString start=+"+ end=+"+ contained
|
|||||||
syn region neosnippetEval start=+\\\@<!`+ end=+\\\@<!`+ contained
|
syn region neosnippetEval start=+\\\@<!`+ end=+\\\@<!`+ contained
|
||||||
syn match neosnippetWord '^\s\+.*$' contains=
|
syn match neosnippetWord '^\s\+.*$' contains=
|
||||||
\neosnippetEval,neosnippetPlaceHolder,neosnippetEscape,neosnippetVariable
|
\neosnippetEval,neosnippetPlaceHolder,neosnippetEscape,neosnippetVariable
|
||||||
syn match neosnippetPlaceHolder '\${\d\+\%(:.\{-}\)\?\\\@<!}'
|
syn match neosnippetPlaceHolder '\\\@<!\${\d\+\%(:.\{-}\)\?\\\@<!}'
|
||||||
\ contained contains=neosnippetPlaceHolderComment
|
\ contained contains=neosnippetPlaceHolderComment
|
||||||
syn match neosnippetVariable '\$\d\+' contained
|
syn match neosnippetVariable '\\\@<!\$\d\+' contained
|
||||||
syn match neosnippetComment '^#.*$'
|
syn match neosnippetComment '^#.*$'
|
||||||
syn match neosnippetEscape '\\[`]' contained
|
syn match neosnippetEscape '\\[`]' contained
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user