0

unfortunately I can't manage to make clang_complete work and I could need your help. I've already compiled vim 7.4 with python support. Here is the output of vim --version | grep python:

+cryptv          +linebreak       +python/dyn      +viminfo
-cscope          +lispindent      +python3/dyn     +vreplace

I followed this guide: https://vtluug.org/wiki/Clang_Complete

Please note that I've started from a clean installation (i.e. no other plugins and no further entries in my .vimrc (except for those shown in the guide above)).

According to the tutorials I've seen so far everything should be working. However, if I try to get code completion for the following example nothing happens. If I press <c-x><x-u> I receive the error "completefunc not set".

#include <string>

int main()
{
   std::string s;
   s.
}

Moreover, I've installed the newest version of clang from source and it in my $PATH.

Is there a way to verify that clang_complete is actually installed?

What might cause this problem?

Any help is much appreciated.

romainl
  • 186,200
  • 21
  • 280
  • 313
user1829358
  • 1,041
  • 2
  • 9
  • 19
  • You can use `:scriptnames` in vim to see a list of enabled plugins – Zach Aug 08 '14 at 19:10
  • I suggest you use the `youcompleteme` plugin. I find it much better than clang – Jesse Aug 08 '14 at 19:43
  • youcompleteme is not really working either, it always shows the following error: "The ycmd server SHUT DOWN (restart with :YcmRestartServer). Stderr (last 30 lines):" and "HTTPConnectionPool(host='127.0.0.1' ...) ... connection refused" – user1829358 Aug 08 '14 at 20:41
  • Does it work after `:e`? Are there any buffer local variables of clang, e.g. `b:clang_something` (try tab complete it for `:echo b:clang_`)? – xaizek Aug 08 '14 at 21:01
  • autocompletion for :echo b:clang_ works. Moreover, I just installed supertab. I'm able to auto-complete stuff that is defined in the local file but the "string s." is still not suggesting anything. Is it possible that clang doesn't find ? – user1829358 Aug 09 '14 at 13:58
  • On the other hand, even if I add the include path to into the .clang_complete file, I still receive the error "Pattern not found". – user1829358 Aug 09 '14 at 14:04

1 Answers1

1

Add

filetype plugin indent on 

to your vimrc, its missing from the vimrc snippet in the link. This tells vim to do filetype detection and fire autocommands related to those file types. Without it you won't run the following autocommands.

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

Which probably initalize ClangComplete.

FDinoff
  • 30,689
  • 5
  • 75
  • 96
  • that's not working either. This is the error message that I get: E117: Unknown function: 2_ClangCompleteInit. Moreover, :scriptnames shows that the clang_complete.vim addon is loaded. – user1829358 Aug 09 '14 at 13:41