1

I'm using vim for only a year. So, I'm a noob. I need help regarding setting up youcompleteme plugin for vim 8.0 with c/c++ semantic and java autocomplete support. I tried 2-3 times with no luck. No autocomplete suggestions appears. I use vundle on manjaro linux. I tried to follow the instructions in the git page README.md but it's just so confusing! I would appreciate a guideline to set up the plugin.

  • 2
    We can't help you if you don't tell us exactly what you did to setup the plugin, how you tried to use it and what doesn't work exactly. The README is pretty complete so if you followed all of the instructions you should ask directly to the plugin maintainer via the issue tracker. – statox Oct 26 '17 at 11:23
  • @user14867: someone has published a guide to install YouCompleteMe on manjaro on gist.github.com/NerdDiffer/765b742a0833ab021cc3063c0a04ee77. Maybe it helps you. – Hotschke Nov 27 '17 at 17:45
1

If you didn't get YCM installed at all you may have issues with having the necessary dependencies but assuming you have YCM successfully installed and you installed like so:

./install --clang-completer

You most likely didn't make a .ycm_extra_conf.py file. (You would have got a big error at the bottom of your terminal "NoExtraConfDetected: No .ycm_extra_conf.py file detected, ...") What this file does is it basically tells YCM what semantic support it need to provide by giving it the flags you would compile with.

Read here for details on semantic support from YCM.

If you have ever made a make file before then your job is super simple! Head on over to YCM-Generator and follow the simple instructions to get going with generating the file.
Otherwise if you are only doing very basic stuff at the moment (don't worry we were all there :) ) then you can probably get away with a basic file and once you become a bit more experienced and require more in depth semantic support config files you'll hopefully be comfortable enough generating a more detailed .ycm_extra_conf.py file.

Here's an example of all that you'd need for now to get going with C:

def FlagsForFile( filename, **kwargs ): 
    return {
      'flags': [ '-x', 'c', '-Wall', '-Wextra', '-Werror' ], 
    }

This tells YCM to give you errors to the same level as compiling your program like so gcc -Wall -Wextra -Werror foo.c. You can go ahead and add/remove flags to this file eg a particular C standard ie -std=gnu99

And then all you need to do is place this file in the directory, or root directory of the program. If you keep all your programs in subfolders of a particular folder, the easiest thing to do for now is just pop it in the main folder.

Java has a similar process which is also well documented in the YCM README.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy