Support ${VISUAL} keyword
This commit is contained in:
parent
fa7cc15aee
commit
9265c5483a
@ -59,19 +59,19 @@ endfunction
|
|||||||
|
|
||||||
" Get marker patterns.
|
" Get marker patterns.
|
||||||
function! neosnippet#get_placeholder_target_marker_pattern() abort
|
function! neosnippet#get_placeholder_target_marker_pattern() abort
|
||||||
return '\%(\\\@<!\|\\\\\zs\)\${\d\+:\(#:\)\?TARGET\%(:.\{-}\)\?\\\@<!}'
|
return '\%(\\\@<!\|\\\\\zs\)\${\d\+:\(#:\)\?\%(TARGET\|\${VISUAL\%(:.\{-}\)\?}\)\%(:.\{-}\)\?\\\@<!}'
|
||||||
endfunction
|
endfunction
|
||||||
function! neosnippet#get_placeholder_marker_pattern() abort
|
function! neosnippet#get_placeholder_marker_pattern() abort
|
||||||
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
|
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
|
||||||
endfunction
|
endfunction
|
||||||
function! neosnippet#get_placeholder_marker_substitute_pattern() abort
|
function! neosnippet#get_placeholder_marker_substitute_pattern() abort
|
||||||
return '\%(\\\@<!\|\\\\\zs\)\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
|
return '\%(\\\@<!\|\\\\\zs\)\${\(\d\+\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
||||||
endfunction
|
endfunction
|
||||||
function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() abort
|
function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() abort
|
||||||
return '\%(\\\@<!\|\\\\\zs\)\${\([1-9]\d*\%(:.\{-}\)\?\\\@<!\)}'
|
return '\%(\\\@<!\|\\\\\zs\)\${\([1-9]\d*\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
||||||
endfunction
|
endfunction
|
||||||
function! neosnippet#get_placeholder_marker_substitute_zero_pattern() abort
|
function! neosnippet#get_placeholder_marker_substitute_zero_pattern() abort
|
||||||
return '\%(\\\@<!\|\\\\\zs\)\${\(0\%(:.\{-}\)\?\\\@<!\)}'
|
return '\%(\\\@<!\|\\\\\zs\)\${\(0\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
||||||
endfunction
|
endfunction
|
||||||
function! neosnippet#get_placeholder_marker_default_pattern() abort
|
function! neosnippet#get_placeholder_marker_default_pattern() abort
|
||||||
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
|
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
|
||||||
|
@ -336,6 +336,7 @@ function! s:expand_placeholder(start, end, holder_cnt, line, ...) abort
|
|||||||
" Remove optional marker
|
" Remove optional marker
|
||||||
let default = substitute(default, '^#:', '', '')
|
let default = substitute(default, '^#:', '', '')
|
||||||
|
|
||||||
|
let default = substitute(default, '\${VISUAL\(:.\{-}\)\?}', 'TARGET\1', '')
|
||||||
let is_target = (default =~ '^TARGET\>' && neosnippet.target != '')
|
let is_target = (default =~ '^TARGET\>' && neosnippet.target != '')
|
||||||
let default = substitute(default, '^TARGET:\?', neosnippet.target, '')
|
let default = substitute(default, '^TARGET:\?', neosnippet.target, '')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user