2012-09-27 15:42:34 +00:00
|
|
|
"=============================================================================
|
|
|
|
" FILE: neosnippet.vim
|
|
|
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
|
|
|
" License: MIT license {{{
|
|
|
|
" Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
" a copy of this software and associated documentation files (the
|
|
|
|
" "Software"), to deal in the Software without restriction, including
|
|
|
|
" without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
" distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
" permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
" the following conditions:
|
|
|
|
"
|
|
|
|
" The above copyright notice and this permission notice shall be included
|
|
|
|
" in all copies or substantial portions of the Software.
|
|
|
|
"
|
|
|
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
" }}}
|
|
|
|
"=============================================================================
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2012-12-13 08:34:20 +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')
|
2015-12-19 01:00:57 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#enable_auto_clear_markers', 1)
|
2016-01-17 09:16:30 +00:00
|
|
|
call neosnippet#util#set_default(
|
|
|
|
\ 'g:neosnippet#completed_pairs',{'_':{ '(' : ')', '{' : '}', '"' : '"' }})
|
2012-09-30 08:17:31 +00:00
|
|
|
"}}}
|
|
|
|
|
2013-01-12 23:08:51 +00:00
|
|
|
function! neosnippet#expandable_or_jumpable() "{{{
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#expandable_or_jumpable()
|
2013-01-12 23:08:51 +00:00
|
|
|
endfunction"}}}
|
2012-12-13 08:34:20 +00:00
|
|
|
function! neosnippet#expandable() "{{{
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#expandable()
|
2012-09-27 15:42:34 +00:00
|
|
|
endfunction"}}}
|
2012-12-13 08:34:20 +00:00
|
|
|
function! neosnippet#jumpable() "{{{
|
2013-11-21 09:10:26 +00:00
|
|
|
return neosnippet#mappings#jumpable()
|
2012-11-03 05:08:11 +00:00
|
|
|
endfunction"}}}
|
2015-11-04 14:57:00 +00:00
|
|
|
function! neosnippet#anonymous(snippet) "{{{
|
|
|
|
return neosnippet#mappings#_anonymous(a:snippet)
|
2015-10-21 12:13:14 +00:00
|
|
|
endfunction"}}}
|
2015-11-03 06:06:23 +00:00
|
|
|
function! neosnippet#expand(trigger) "{{{
|
|
|
|
return neosnippet#mappings#_expand(a:trigger)
|
|
|
|
endfunction"}}}
|
2012-11-03 05:08:11 +00:00
|
|
|
|
2012-12-13 08:34:20 +00:00
|
|
|
function! neosnippet#get_snippets_directory() "{{{
|
2013-11-21 09:40:40 +00:00
|
|
|
return neosnippet#helpers#get_snippets_directory()
|
2012-09-27 15:42:34 +00:00
|
|
|
endfunction"}}}
|
2013-02-17 04:10:41 +00:00
|
|
|
function! neosnippet#get_user_snippets_directory() "{{{
|
2013-11-21 09:20:36 +00:00
|
|
|
return copy(neosnippet#variables#snippets_dir())
|
2013-02-17 04:10:41 +00:00
|
|
|
endfunction"}}}
|
|
|
|
function! neosnippet#get_runtime_snippets_directory() "{{{
|
2013-11-21 09:20:36 +00:00
|
|
|
return copy(neosnippet#variables#runtime_dir())
|
2013-02-17 04:10:41 +00:00
|
|
|
endfunction"}}}
|
2012-09-27 15:42:34 +00:00
|
|
|
|
2013-11-21 09:20:36 +00:00
|
|
|
" Get marker patterns.
|
2012-12-13 08:34:20 +00:00
|
|
|
function! neosnippet#get_placeholder_target_marker_pattern() "{{{
|
2016-01-11 04:09:45 +00:00
|
|
|
return '\${\d\+:\(#:\)\?TARGET\%(:.\{-}\)\?\\\@<!}'
|
2012-10-29 23:03:53 +00:00
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_placeholder_marker_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_placeholder_marker_substitute_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
|
|
|
|
endfunction"}}}
|
2015-12-19 03:16:36 +00:00
|
|
|
function! neosnippet#get_placeholder_marker_substitute_nonzero_pattern() "{{{
|
|
|
|
return '\${\([1-9]\d*\%(:.\{-}\)\?\\\@<!\)}'
|
|
|
|
endfunction"}}}
|
2015-12-19 03:27:49 +00:00
|
|
|
function! neosnippet#get_placeholder_marker_substitute_zero_pattern() "{{{
|
|
|
|
return '\${\(0\%(:.\{-}\)\?\\\@<!\)}'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_placeholder_marker_default_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_sync_placeholder_marker_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_sync_placeholder_marker_default_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<{\d\+:\zs.\{-}\ze\\\@<!}>'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_mirror_placeholder_marker_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '<|\d\+|>'
|
|
|
|
endfunction"}}}
|
2013-11-18 11:14:01 +00:00
|
|
|
function! neosnippet#get_mirror_placeholder_marker_substitute_pattern() "{{{
|
2012-09-27 15:42:34 +00:00
|
|
|
return '\$\(\d\+\)'
|
|
|
|
endfunction"}}}
|
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: foldmethod=marker
|