- Added neocomplcache#sources#snippets_complete#force_expandable() and
neocomplcache#sources#snippets_complete#jumpable().
This commit is contained in:
parent
322041ae04
commit
a9aaca8582
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: snippets_complete.vim
|
" FILE: snippets_complete.vim
|
||||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||||
" Last Modified: 25 Feb 2012.
|
" Last Modified: 03 Mar 2012.
|
||||||
" 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
|
||||||
@ -232,23 +232,29 @@ function! s:keyword_filter(list, cur_keyword_str)"{{{
|
|||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
function! neocomplcache#sources#snippets_complete#expandable()"{{{
|
function! neocomplcache#sources#snippets_complete#expandable()"{{{
|
||||||
let snippets = neocomplcache#sources#snippets_complete#get_snippets()
|
|
||||||
let cur_text = neocomplcache#get_cur_text(1)
|
|
||||||
|
|
||||||
let ret = 0
|
let ret = 0
|
||||||
|
|
||||||
if s:get_cursor_keyword_snippet(snippets, cur_text) != ''
|
if neocomplcache#sources#snippets_complete#expandable_trigger()
|
||||||
" Found snippet trigger.
|
|
||||||
let ret += 1
|
let ret += 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if search('\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>', 'nw') > 0
|
if neocomplcache#sources#snippets_complete#jumpable()
|
||||||
" Found snippet placeholder.
|
|
||||||
let ret += 2
|
let ret += 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
function! neocomplcache#sources#snippets_complete#expandable_trigger()"{{{
|
||||||
|
let snippets = neocomplcache#sources#snippets_complete#get_snippets()
|
||||||
|
let cur_text = neocomplcache#get_cur_text(1)
|
||||||
|
|
||||||
|
" Found snippet trigger.
|
||||||
|
return s:get_cursor_keyword_snippet(snippets, cur_text) != ''
|
||||||
|
endfunction"}}}
|
||||||
|
function! neocomplcache#sources#snippets_complete#jumpable()"{{{
|
||||||
|
" Found snippet placeholder.
|
||||||
|
return search('\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>', 'nw') > 0
|
||||||
|
endfunction"}}}
|
||||||
|
|
||||||
function! s:caching()"{{{
|
function! s:caching()"{{{
|
||||||
for filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype(1))
|
for filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype(1))
|
||||||
|
@ -145,6 +145,18 @@ neocomplcache#sources#snippets_complete#expandable()
|
|||||||
>
|
>
|
||||||
imap <expr><C-l> neocomplcache#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>"
|
imap <expr><C-l> neocomplcache#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>"
|
||||||
<
|
<
|
||||||
|
neocomplcache#sources#snippets_complete#force_expandable()
|
||||||
|
*neocomplcache#sources#snippets_complete#force_expandable()*
|
||||||
|
Use this function on inoremap <expr>. It check whether cursor
|
||||||
|
text is snippets triggerThis function is useful when saving
|
||||||
|
keymappings.
|
||||||
|
|
||||||
|
neocomplcache#sources#snippets_complete#jumpable()
|
||||||
|
*neocomplcache#sources#snippets_complete#jumpable()*
|
||||||
|
Use this function on inoremap <expr>. It check whether exists
|
||||||
|
placeholder in current buffer. This function is useful when
|
||||||
|
saving keymappings.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
EXAMPLES *neocomplcache-snippets-complete-examples*
|
EXAMPLES *neocomplcache-snippets-complete-examples*
|
||||||
>
|
>
|
||||||
@ -281,6 +293,10 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
CHANGELOG *neocomplcache-snippets-complete-changelog*
|
CHANGELOG *neocomplcache-snippets-complete-changelog*
|
||||||
|
|
||||||
|
2012-03-03
|
||||||
|
- Added neocomplcache#sources#snippets_complete#force_expandable() and
|
||||||
|
neocomplcache#sources#snippets_complete#jumpable().
|
||||||
|
|
||||||
2012-02-25
|
2012-02-25
|
||||||
- Improved split().
|
- Improved split().
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user