diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index a508640..dedfb03 100644 --- a/autoload/neocomplcache/sources/snippets_complete.vim +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: snippets_complete.vim " AUTHOR: Shougo Matsushita -" Last Modified: 25 Feb 2012. +" Last Modified: 03 Mar 2012. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -232,23 +232,29 @@ function! s:keyword_filter(list, cur_keyword_str)"{{{ endfunction"}}} 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 - if s:get_cursor_keyword_snippet(snippets, cur_text) != '' - " Found snippet trigger. + if neocomplcache#sources#snippets_complete#expandable_trigger() let ret += 1 endif - if search('\${\d\+\%(:.\{-}\)\?\\\@', 'nw') > 0 - " Found snippet placeholder. + if neocomplcache#sources#snippets_complete#jumpable() let ret += 2 endif return ret 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\+\%(:.\{-}\)\?\\\@', 'nw') > 0 +endfunction"}}} function! s:caching()"{{{ for filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype(1)) diff --git a/doc/neocomplcache-snippets-complete.txt b/doc/neocomplcache-snippets-complete.txt index 601e8ba..42f1206 100644 --- a/doc/neocomplcache-snippets-complete.txt +++ b/doc/neocomplcache-snippets-complete.txt @@ -145,6 +145,18 @@ neocomplcache#sources#snippets_complete#expandable() > imap neocomplcache#snippets_complete#expandable() ? "\(neocomplcache_snippets_expand)" : "\" < +neocomplcache#sources#snippets_complete#force_expandable() + *neocomplcache#sources#snippets_complete#force_expandable()* + Use this function on inoremap . 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 . It check whether exists + placeholder in current buffer. This function is useful when + saving keymappings. + ============================================================================== EXAMPLES *neocomplcache-snippets-complete-examples* > @@ -281,6 +293,10 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet* ============================================================================== CHANGELOG *neocomplcache-snippets-complete-changelog* +2012-03-03 +- Added neocomplcache#sources#snippets_complete#force_expandable() and + neocomplcache#sources#snippets_complete#jumpable(). + 2012-02-25 - Improved split().