2012-09-27 15:42:34 +00:00
|
|
|
"=============================================================================
|
|
|
|
" FILE: neosnippet.vim
|
2017-06-15 00:11:15 +00:00
|
|
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
2017-06-15 00:04:27 +00:00
|
|
|
" License: MIT license
|
2012-09-27 15:42:34 +00:00
|
|
|
"=============================================================================
|
|
|
|
|
2017-10-01 13:40:17 +00:00
|
|
|
" Global options definition.
|
2012-10-04 08:51:15 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#disable_runtime_snippets', {})
|
2014-01-01 02:00:43 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#scope_aliases', {})
|
2012-10-04 08:51:15 +00:00
|
|
|
call neosnippet#util#set_default(
|
2013-11-12 09:13:13 +00:00
|
|
|
\ 'g:neosnippet#snippets_directory', '')
|
2012-10-04 08:51:15 +00:00
|
|
|
call neosnippet#util#set_default(
|
2013-06-04 13:39:30 +00:00
|
|
|
\ 'g:neosnippet#disable_select_mode_mappings', 1)
|
2012-11-02 01:48:55 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#enable_snipmate_compatibility', 0)
|
2014-03-11 12:28:47 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#expand_word_boundary', 0)
|
2015-06-23 12:51:14 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#enable_conceal_markers', 1)
|
2015-12-11 18:07:13 +00:00
|
|
|
call neosnippet#util#set_default(
|
2015-12-26 02:42:46 +00:00
|
|
|
\ 'g:neosnippet#enable_completed_snippet', 0,
|
|
|
|
\ 'g:neosnippet#enable_complete_done')
|
2017-06-17 02:50:37 +00:00
|
|
|
call neosnippet#util#set_default(
|
2017-06-20 01:04:58 +00:00
|
|
|
\ 'g:neosnippet#enable_optional_arguments', 1)
|
2015-12-19 01:00:57 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#enable_auto_clear_markers', 1)
|
2017-10-01 13:40:17 +00:00
|
|
|
|
|
|
|
function! neosnippet#expandable_or_jumpable() abort
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#expandable_or_jumpable()
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#expandable() abort
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#expandable()
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#jumpable() abort
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#jumpable()
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#anonymous(snippet) abort
|
2015-11-04 14:57:00 +00:00
|
|
|
return neosnippet#mappings#_anonymous(a:snippet)
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#expand(trigger) abort
|
2015-11-03 06:06:23 +00:00
|
|
|
return neosnippet#mappings#_expand(a:trigger)
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
2018-02-18 10:42:39 +00:00
|
|
|
function! neosnippet#complete_done() abort
|
|
|
|
return neosnippet#mappings#_complete_done(
|
|
|
|
\ neosnippet#util#get_cur_text(), col('.'))
|
|
|
|
endfunction
|
2012-11-03 05:08:11 +00:00
|
|
|
|
2017-10-01 13:40:17 +00:00
|
|
|
function! neosnippet#get_snippets_directory() abort
|
2013-11-21 09:40:40 +00:00
|
|
|
return neosnippet#helpers#get_snippets_directory()
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_user_snippets_directory() abort
|
2013-11-21 09:20:36 +00:00
|
|
|
return copy(neosnippet#variables#snippets_dir())
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_runtime_snippets_directory() abort
|
2013-11-21 09:20:36 +00:00
|
|
|
return copy(neosnippet#variables#runtime_dir())
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
2012-09-27 15:42:34 +00:00
|
|
|
|
2013-11-21 09:20:36 +00:00
|
|
|
" Get marker patterns.
|
2017-10-01 13:40:17 +00:00
|
|
|
function! neosnippet#get_placeholder_target_marker_pattern() abort
|
2018-06-03 10:53:52 +00:00
|
|
|
return '\%(\\\@<!\|\\\\\zs\)\${\d\+:\(#:\)\?\%(TARGET\|\${VISUAL\%(:.\{-}\)\?}\)\%(:.\{-}\)\?\\\@<!}'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_placeholder_marker_pattern() abort
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_placeholder_marker_substitute_pattern() abort
|
2018-06-03 10:53:52 +00:00
|
|
|
return '\%(\\\@<!\|\\\\\zs\)\${\(\d\+\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() abort
|
2018-06-03 10:53:52 +00:00
|
|
|
return '\%(\\\@<!\|\\\\\zs\)\${\([1-9]\d*\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_placeholder_marker_substitute_zero_pattern() abort
|
2018-06-03 10:53:52 +00:00
|
|
|
return '\%(\\\@<!\|\\\\\zs\)\${\(0\%(:\%(\${VISUAL\%(:.\{-}\)\?}\)\?.\{-}\)\?\\\@<!\)}'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_placeholder_marker_default_pattern() abort
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_sync_placeholder_marker_pattern() abort
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_sync_placeholder_marker_default_pattern() abort
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<{\d\+:\zs.\{-}\ze\\\@<!}>'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_mirror_placeholder_marker_pattern() abort
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<|\d\+|>'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|
|
|
|
function! neosnippet#get_mirror_placeholder_marker_substitute_pattern() abort
|
2017-04-19 22:25:32 +00:00
|
|
|
return '\\\@<!\$\(\d\+\)'
|
2017-10-01 13:40:17 +00:00
|
|
|
endfunction
|