Search code examples
vimneocomplcache

Disable NeoComplCache based on filetype


I am trying to get vim setup such that when I edit a C or C++ file it uses the YouCompleteMe plugin for completions, and for everything else it uses NeoComplCache.

I'm starting with v3.0 of the spf13 vim configuration.

I've added the following to my .vimrc.bundles.local:

Bundle 'Valloric/YouCompleteMe'

I've added the following to my .vimrc.local:

let g:ycm_filetype_whitelist = { 'c': 1, 'cpp': 1 }
let g:neocomplcache_force_overwrite_completefunc = 0

This appears to disable YouCompleteMe for everything except C/C++, however I'm not sure how to disable NeoComplCache based on filetype. I have tried:

autocmd FileType c,cpp :NeoComplCacheDisable

However, it appears that NeoComplCache isn't really enabled until you do something in the buffer. What kind of configuration is needed to disable NeoComplCache when I open a C or C++ file in vim?


Solution

  • Here's how I disabled NeoCompleCache for my .vimrc:

    " Disable NeoComplCache for certain filetypes
    if has('autocmd')
      autocmd FileType pandoc,markdown nested NeoComplCacheLock
     endif
    

    References: