Vim安装YouCompleteMe卡在/go/src/golang.org/x/tools安装不了

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修改后重新安装

  1. 跟之前一样先执行git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle,此时路径~/.vim/bundle/YouCompleteMe/third_party/ycmd为空的。

  2. 然后在文件夹YouCompleteMe中执行git submodule update --init。此时没有--recursive
    此时路径~/.vim/bundle/YouCompleteMe/third_party/ycmd下会增加很多文件,

  3. 然后编辑文件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

  4. 再按要求执行
    git submodule update --init --recursive

  5. 之后的安装跟配置网上都有很多

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章