Frage

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?

War es hilfreich?

Lösung

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:

Andere Tipps

This is what I use for editing markdown files, it should work c,cpp as well.

" Turn off completion, it's more disruptive than helpful
function! s:markdown_disable_autocomplete()
  if &ft ==# 'markdown'
    :NeoComplCacheLock
  endif
endfunction
autocmd MyAutoCmd BufEnter * call s:markdown_disable_autocomplete()
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top