I want to customize neocomplcache.vim <Tab> key mapping.

So I want a smart *function* to use <Tab>.

What do I want neocomplcache <Tab> to complete:
Use neocomplcache.vim's functions(at bellowing details) to check current <expr> 
is a snip trigger.
If <expr> is a snip trigger, then press <Tab> to expand multi-lines snippet.
If it is a placeholder, then press <Tab> to complete keyword or omni-completion 
or other things.
If it is both snip trigger and placeholder, then use a Popup menu to let user 
select.
If it is nothing, then do nothing.

Here is some functions I found in help doc. for reference.

<Plug>(neocomplcache_snippets_expand)                   
*<Plug>(neocomplcache_snippets_expand)*
                Expand a cursor snippet of plural lines. When there is not
                snippet, jump to the next placeholder.
                
                Note: cursor snippet must be match keyword patterns.
                For example if snippet name is ".", snippets_complete don't 
expand it.
                If you expand snippet ".",  Please use
                |<Plug>(neocomplcache_snippets_force_expand)|.

<Plug>(neocomplcache_snippets_jump)                     
*<Plug>(neocomplcache_snippets_jump)*
                Jump to the next placeholder. If there is no
                placeholder, expand a multiline cursor snippet.

neocomplcache#sources#snippets_complete#expandable()    
*neocomplcache#sources#snippets_complete#expandable()*
                Use this function on inoremap <expr>. It check whether
                cursor text is snippets trigger or exists placeholder in
                current buffer. This function is useful when saving
                keymappings.
                Return value is
                0 : not found
                1 : cursor text is snippets trigger
                2 : exists placeholder in current buffer
                3 : both found.
>
                imap <expr><C-l>    
neocomplcache#snippets_complete#expandable() ? 
"\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>"
<

-- 
>> stardiviner <<  =>GPG: 5D9F64D8 Twitter: @numbchild
http://stardiviner.dyndns-blog.com/author.html

Attachment: signature.asc
Description: Digital signature

Reply via email to