vim代码自动补全插件——YouCompleteMe安装(MacOS)
YouCompleteMe简介
vim作为“最好的IDE”,自然需要一个强大的代码自动补全插件来提高生产力。YouCompleteMe是一个非常强大的插件,这个项目在github有1w的star。它支持多种语言、具有类ctags的功能,是其吸引我的主要原因。
下面就和大家分享一下YouCompleteMe在MAC上的安装流程。
基于vundle的安装
1. 安装vundle
vundle是一个管理vim插件的工具,使用vundle安装YouCompleteMe比较方便。可以参照vundle官方提供的安装方法https://github.com/VundleVim/Vundle.vim#about 进行安装。
2. 安装YouCompleteMe
修改 ~/.vimrc , 在vundle部分添加一行
Plugin ‘Valloric/YouCompleteMe’
然后在vim中输入命令
:PluginInstall
vim会自动安装这些插件。
在这个过程中,我遇到了git的错误RPC failed; curl 18 transfer closed with outstanding read data remaining
参考网上的解决方案,手工从github上clone这个repo:https://github.com/Valloric/YouCompleteMe ,用命令:
//注意:是ssh方式不是https的方式,即将https:// 改为 git://
git clone git://github.com/Valloric/YouCompleteMe.git
至此,YouCompleteMe 已经安装完成,但是我尝试运行vim时
遇到了Caught deadly singal SEGV,搜了一下,网上也有很多人遇到了类似的问题,下一部分我主要分享一下我的解决办法。
3. Caught deadly singal SEGV
错误为
Caught deadly singal SEGV
Error detected while processing function <SNR>32_PollServerReady[7]…<SNR>32_Pyeval:Vim: Finishedline 4
Exception MemoryError: MemoryError() in <module ‘threading’ from ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc’> ignored
53227 segmentation fault vim
参考官方github的issue:https://github.com/Valloric/YouCompleteMe/issues/361 和网上的教程,我猜测是python版本的问题。用如下命令解决了问题:
brew unlink python