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. 之後的安裝跟配置網上都有很多

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