安装环境
- gVim 7.4 32-bit 2013 Aug 10
- Python 2.7.12 32-bit (https://www.python.org/downloads/windows/)
- Visual Studio 2012
- Clang 3.8.1 (http://llvm.org/releases/download.html)
- CMake 3.6.1 (https://cmake.org/)
步骤
- 安装Vundle (https://github.com/VundleVim/Vundle.vim#about)
- 在确定Vundle能工作后,在_vimrc中加入: Plugin ‘Valloric/YouCompleteMe’
- 在Vim中输入:PluginInstall,等待YouCompleteMe安装完成。如果不能下载成功,请使用代理。由于防火墙的原因,GitHub有可能连不上。
- 当YouCompleteMe下载完成后,确认其下载路径。本人的路径如下:
~/.vim/bundle/YouCompleteMe
- 拷贝所有LLVM的foler到
~\ycm_temp\llvm_root_dir
, 本人的clang安装在c:\LLVM
cd ~
mkdir ycm_temp
cd ycm_temp
mkdir llvm_root_dir
cd llvm_root_dir
xcopy -E c:\LLVM .
- 使用CMake生成工程文件
cd ~
mkdir ycm_build
cd ycm_build
cmake -G "Visual Studio 12" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
- 如果你安装的是其他版本的Visual Studio, 请将上面的command更改成相应的版本。
Visual Studio 11 Win64
Visual Studio 12 Win64
Visual Studio 14 Win64
如果是32位的Visual Studio, 请去掉
Win64
Build CMake生成的工程文件
cmake --build . --target ycm_core --config Release
常见问题
32位/64位软件问题
如果Vim是32位的,请确保Python, Visual Studio, Clang都是32位的
Can not find python27.lib
本人在使用Python 2.7.3时遇到过这个问题,再卸载Python, 安装Python 2.7.12后,问题消失。
环境变量
确保你的PATH变量中包含了Python, Clang
快速方案
如果不想编译YouCompleteMe, 可以直接使用以下已经编译好的插件:
编译环境:python2.7-32bit, VS2015, LLVM5.0
http://download.csdn.net/download/huangkangying/10165684