vim使用Vundle安装YouCompleteMe插件

使用的系统是ubuntu18.04

1.首先安装git:sudo apt install git。

2.安装clang:sudo apt install clang。

3.安装python:sudo apt install python3、sudo apt install python3-dev。 

4.cd到用户路径下,安装Vundle:cd ~;git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim .

5.cd到bundle目录下:cd ~/.vim/bundle。

6.git YouCompleteMe插件:git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe。

7.cd到ycm目录下:cd ~/.vim/bundle/YouCompleteMe。

8.执行:git submodule update --init --recursive,然后就是漫长的等待。这里有可能会有一个问题,就是克隆“third_party/go/src/golang.org/x/tools”失败,因为下载这个的地址不对,需要修改,具体操作步骤:在YouCompleteMe目录下执行:grep -r "https://go.googlesource.com/tools",然后在查找的结果的地方修改地址:vi third_party/ycmd/.gitmodules,把url = 后面的地址改成https://github.com/golang/tools,保存退出。把查找到的两个地方都修改了,然后继续执行:git submodule update --init --recursive。

9.然后运行:python3 install.py --all安装所有语言的插件,也可以选择语言安装,输入python3 install.py --就会有参数说明。

10.有可能会报错:.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex" does not appear to contain CMakeLists.txt,解决的办法就是删除该目录:rm -rf .vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex,然后执行:git submodule update --init --recursive,然后执行:python3 install.py --all。

11.修改vimrc文件:vim ~/.vimrc,在最下方添加:

"set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'

call vundle#end()
filetype plugin indent on


let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_collect_identifiers_from_tag_files = 1
set completeopt-=preview
set completeopt=longest,menu
let g:ycm_confirm_extra_conf=0
let g:ycm_cache_omnifunc=0
let g:ycm_complete_in_comments=1
let g:ycm_min_num_of_chars_for_completion=1
let g:ycm_error_symbol='>>'
let g:ycm_warning_symbol='>*'

“寻找全局配置文件let g:ycm_global_ycm_extra_conf =“这行根据自己的路径修改,我的在YouCompleteMe这个目录下。

好了,现在你可以是试试了。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

双鱼理

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值