VIM的YCM插件安装 编写C语言

第一步 安装vim cmake python

sudo apt install build-essential cmake vim-nox python3-dev

第二步 安装clang

sudo apt-get install clang

第三步 安装git

sudo apt-get install git

第四步 安装VUNDLE

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

在家目录下,vim .vimrc
在.vimrc文件中粘贴下边几句话:

set shell=/bin/bash
 
set nocompatible              " be iMproved, required
filetype off                  " required
 
" set the runtime path to include Vundle and initialize
  set rtp+=~/.vim/bundle/Vundle.vim
  call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
 
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

打开VIM输入

:PluginInstall

第五步 安装YCM

输入命令

cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
cd ~/.vim/bundle/YouCompleteMe

然后输入以下命令,在git过程中可能会出现错误,继续git submodule update --init --recursive

git submodule update --init --recursive

上面这部分超级慢,上次搞了我一个多小时,耐心等着就行

第六步 编译YCM

编译的时候也是很慢的

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clangd-completer

在这里插入图片描述
出现这3个ok就是编译完成了。

等待编译完成后,在 vim 的配置文件 ~/.vimrc 中添加一行(在call vundle#begin() 和 call vundle#end() 之间)

call vundle#begin()
. . .
Plugin ‘Valloric/YouCompleteMe’
. . .
call vundle#end()

然后保存运行 vim 命令 :PluginInstall。
此时基本完成了,但需要一些配置才能智能提示和代码补全功能。

配置YCM

在这里插入图片描述
第72的参数路径是你存放.ycm_extra_conf.py的路径

效果如图

在这里插入图片描述
参考链接https://www.freesion.com/article/7538590478/
参考链接https://github.com/ycm-core/YouCompleteMe#installation

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值