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.
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:
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
Here's an example of all that you'd need for now to get going with C:
def FlagsForFile( filename, **kwargs ):
'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
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