before:
Ensure that your version of Vim is at least 7.4.1578 and that it has support for Python 2 or Python 3 scripting.
1.Install YCM
you can install it with Vundle (or Pathogen, but Vundle is a better idea)
but If you don't install YCM with Vundle, make sure you have run this command after checking out the YCM repository (Vundle will do this for you)
git submodule update --init --recursive
2.C-family languages(if you need)
2.1、Download the latest version of libclang ->libclang下载
3.Compile the ycm_core
library
3.1 create a new folder where build files will be placed. Run the following:
cd ~
mkdir ycm_build
cd ycm_build
3.2 generate the makefiles:
if you don't need c-family languages:
generator is "Unix Makefile" on unix-like os
cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
if you need ,and you downloaded LLVM binary package, not a custom-built LLVM
cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
if you have you use the system version of libclang, you would pass -DUSE_SYSTEM_LIBCLANG=ON
to cmake instead ofthe -DPATH_TO_LLVM_ROOT=...
or you have a pre-built clang:
-DEXTERNAL_LIBCLANG_PATH=/path/to/libclang.so
For those who want to use the system version of boost, you would pass-DUSE_SYSTEM_BOOST=ON
to cmake
NOTE: I STRONGLY recommend AGAINST use of the system boost/libclang insteadof the bundled version of boost/libclang
3.3 build
cmake --build . --target ycm_core --config Release
4. Last
cp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/