配置vim作为golang编译器时,提示YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+)”的错误提示,于是下载了vim源码进行了手工编译:
git clone https://github.com/vim/vim.git
cd vim
./configure --enable-pythoninterp=yes --enable-python3interp=yes
make
cp src/vim /usr/local/bin/vim
cd /usr/local/bin/
ln -s vim vi
vim进去后,提示
The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library not detected; you need to compile YCM before using it. Follow the instructions in the documentation.
在vim命令行重启后,提示报错,查看日志提示
Traceback (most recent call last):
File "/Users/tauren/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 505, in ImportAndCheckCore
ycm_core = ImportCore()
File "/Users/tauren/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 493, in ImportCore
import ycm_core as ycm_core
ModuleNotFoundError: No module named 'ycm_core'
进入YouCompleteMe目录
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --go-completer
ERROR: Unable to find cmake executable in any of ['cmake3', 'cmake']. CMake is required to build ycmd
The installation failed; please see above for the actual error. In order to get more information, please re-run the command, adding the --verbose flag. If you think this is a bug and you raise an issue, you MUST include the *full verbose* output.
For example, run:/usr/local/bin/python3 /Users/tauren/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py --clang-completer --verbose
于是手工安装cmake
brew install cmake
安装成功后,vim重新打开,不再提示报错