Linux安装YouCompleteMe一般有两种方法,使用bundle安装,或者直接使用git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle
,可是无论哪种方法,(国内)经常会卡在安装第三方包时/go/src/golang.org/x/tools
这儿。
原因: 无论哪种方法,执行完git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle
后,需要在~/.vim/bundle/YouCompleteMe
路径下进行操作git submodule update --init --recursive
,由于有一个源是google的,国内连不上,所以会出错。
修改办法:
首先将之前失败的安装都删除,然后按照下面方法一步步安装,或者直接按照步骤3修改后重新安装。
-
跟之前一样先执行
git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle
,此时路径~/.vim/bundle/YouCompleteMe/third_party/ycmd
为空的。 -
然后在文件夹
YouCompleteMe
中执行git submodule update --init
。此时没有--recursive
此时路径~/.vim/bundle/YouCompleteMe/third_party/ycmd
下会增加很多文件, -
然后编辑文件
vim ~/.vim/bundle/YouCompleteMe/third_party/ycmd/.gitmodules
。
将最后[submodule "third_party/go/src/golang.org/x/tools"]
中的URL如下修改:
将
url = https://go.googlesource.com/tools
ignore = dirty
修改为
url = https://github.com/golang/tools
-
再按要求执行
git submodule update --init --recursive
-
之后的安装跟配置网上都有很多