Search code examples
vimclang-complete

My clang-complete doesn't run well in my Vim


I installed clang-complete by using Vundle,and downloaded llvm using sudo apt install llvm-4.0, downloaded clang by using sudo apt install libclang-4.0.Here is my .vimrc:

let g:clang_complete_auto=1     " automatically complete after -> . ::
let g:clang_hl_errors=1         " highlight the warnings and error the same way clang does it
let g:clang_complete_copen=0    " open quickfix window on error
let g:clang_periodic_quickfix=0 " periodically update the quickfix window
let g:clang_snippets=0
let g:clang_close_preview=1
let g:clang_use_library=1
let g:clang_library_path='/usr/lib/llvm-4.0/lib'
let g:clang_user_options='-stdlib=libc++ -std=c++11 -I /usr/include/c++/8/'
set completeopt=menu,longest

However, it doesn't run well in this way. When I type std::, the menu only shows some useless items such as size_t but except cout etc.


Solution

  • Follow the Troubleshooting section in the README of your plugin. It says that the first step is to check completefunc and omnifunc when in your C++ buffer, and then to check the output of :messages. I think that knowing what those settings are at runtime of your Vim would show us what's going on.

    If completefunc isn't set, then there's something going on with one of your settings; the plugin is trying to do what it does, but one of your settings are improperly formatted (or something like that.) The output of :messages should be able to show you which setting this is, as well.