Jun 17, 2010

SuperTab complete for neocomplcache

As I said in my previous post, neocomplcache is a very powerful vim plugin.
It incoporates the funtionality of SnipMate and  AutoComplPop while providing efficient search
for potential completion items.

However, SuperTab does not support neocomplcache. It is very bad since I like to tab complete
everything, including snippets. Here is the solution -- put the following in you .vimrc:

imap  <silent><expr><tab>  neocomplcache#sources#snippets_complete#expandable() ? "\<plug>(neocomplcache_snippets_expand)" : (pumvisible() ? "\<c-e>" : "\<tab>")
smap  <tab>  <right><plug>(neocomplcache_snippets_jump) 
inoremap <expr><c-e>     neocomplcache#complete_common_string()

The above setting allows you to trigger a snippet with "tab" key when possible. If not, it will simply trigger omni completion. I set it to complete the longest common string. It is just a personal taste. You can set it to other type of completion as well.

*Update 2010/12/11 for necomplcache V5.2 compatiblity
*Update 2012/04/24 for necomplcache V7 compatiblity

2 comments:

Alex said...

Great!

Could you post your .vimrc settings for neocomplcache?

Specifically I don't like its auto popup behavior - think that SuperTab with its manual activation is better. IMO, of course.
Besides mapping you gave doesn't work if this is the only you add to .vimrc - guess you need to enable neocomplcache by default (at least)

AFAICS, neocomplcache can't provide context information - like showing method for class (omni should do it for lang of your choice). But you've stopped using omnicppcomplete - why?

And one more thing if we compare neocomplcache with SuperTab is the way it chooses variants. SuperTab has ,, etc. I'm talking not about mappings, but the meaning - like search all included files/use tags/current file/etc.

A lot of questions, but may be you find time to answer (another post?)

Thank you.

Lono said...

Context information is supported
by neocomplcache. However, the author
disabled the context infomation of C/C++ in recent release for some reason.

neocomplcache do support the search
of all included files/use tags/current file.
What is the problem?

As for auto popup setting, I believe you can send a feature request to the author thourgh github. It should not be hard to do.

 
TEMPLATE HACKS AND TWEAKS BY [ METAMUSE ] BLACKCAT 1.1
/scripts/shBrushJScript.js'/>