Search code examples
vimclang-completeneocomplcache

Using neocomplcache and clang_complete?


I'm trying to make clang_complete and neocomplcache to play along nicely. My problem is that when I open a cpp, c, objc or objcpp file I get the following error from neocomplcache

completefunc=ClangComplete^@^ILast set from ~/.vim/plugin/clang_complete.vim
Another plugin set completefunc! Disabled neocomplcache. 

clang_complete.vim has the following configuration line:

au FileType c,cpp,objc,objcpp call <SID>ClangCompleteInit()

My question is if there's a way so that I don't get this error anymore ? Is there a way I could use clang_complete and somehow still have access to let's say neocomplcache snippets ?


Solution

  • This config fixed the problem (in my Vimrc)

    if !exists('g:neocomplcache_force_omni_patterns')
        let g:neocomplcache_force_omni_patterns = {}
    endif
    let g:neocomplcache_force_overwrite_completefunc = 1
    let g:neocomplcache_force_omni_patterns.c =
                \ '[^.[:digit:] *\t]\%(\.\|->\)'
    let g:neocomplcache_force_omni_patterns.cpp =
                \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
    let g:neocomplcache_force_omni_patterns.objc =
                \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
    let g:neocomplcache_force_omni_patterns.objcpp =
                \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
    let g:clang_complete_auto = 0
    let g:clang_auto_select = 0
    let g:clang_use_library = 1