#安装vim-plug或者vundle(可选)
#你需要安装cmake来进行下面的工作
1、安装ycm
1.1、从github安装ycm
# 下载 (在 `~/.vim/bundle` 目录下) $ git clone --recursive [https://github.com/Valloric/YouCompleteMe.git]( https://github.com/Valloric/YouCompleteMe.git) # 检查完整性(在 `~/.vim/bundle/YouCompleteMe` 目录下) $ git submodule update --init --recursive
2、添加c/c++语义补全
(推荐下载二进制包,当然你也可以直接编译安装clang和llvm),下载地址clang+llvm。你可能还需要python-dev和python3-dev。
cd ~ mkdir ycm_build cd ycm_build
然后讲你下载的文件里的内容解压,‘~/ycm_temp/llvm_root_dir’为你解压后的文件目录
cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
cmake -G "<generator>" DEXTERNAL_LIBCLANG_PATH=“你的libclang.so的位置” . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
# --config Release 这个构建选项进针对 Windows $ cmake --build . --target ycm_core --config Release
复制 .ycm_extra_conf.py 文件
3、配置
$ cp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/
参考:https://github.com/Valloric/YouCompleteMe/blob/master/README.md
https://www.v2ex.com/t/341751
本文介绍如何安装YouCompleteMe插件并设置C/C++语义补全功能,包括从GitHub克隆插件、配置编译环境、安装依赖库以及设置额外配置文件等步骤。
3132

被折叠的 条评论
为什么被折叠?



