vim 语法补齐插件: YouCompleteMe

step1: download vundle plugin
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/Vundle.vim

step2: configure vundle plugin in vimrc
reference: .vim/bundle/Vundle.vim/README_ZH_CN.md

请将以下加在 .vimrc文件末尾 方可使用Vundle. 删掉你不需要的插件, 这些只是用做示例.

set nocompatible " 去除VI一致性,必须
filetype off " 必须

" 设置包括vundle和初始化相关的runtime path
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" 另一种选择, 指定一个vundle安装插件的路径
"call vundle#begin('~/some/path/here')

" 让vundle管理插件版本,必须
Plugin 'VundleVim/Vundle.vim'

" YouCompleteMe Plugin
Plugin 'Valloric/YouCompleteMe'

" 你的所有插件需要在下面这行之前
call vundle#end() " 必须
filetype plugin indent on " 必须 加载vim自带和插件相应的语法和文件类型相关脚本
" 忽视插件改变缩进,可以使用以下替代:
"filetype plugin on
"
" 简要帮助文档
" :PluginList - 列出所有已配置的插件
" :PluginInstall - 安装插件,追加 `!` 用以更新或使用 :PluginUpdate
" :PluginSearch foo - 搜索 foo ; 追加 `!` 清除本地缓存
" :PluginClean - 清除未使用插件,需要确认; 追加 `!` 自动批准移除未使用插件
"
" 查阅 :h vundle 获取更多细节和wiki以及FAQ
" 将你自己对非插件片段放在这行之后

step3: verify vundle
#vim .
#PluginList
如果你可看到下图效果,说明vundle安装成功
vundle installation
step4: install YouCompleteMe
#vim .
#PluginInstall
YouCompleteMe Installation

step5: install dependency libs
reference:~/.vim/bundle/YouCompleteMe/doc/youcompleteme.txt
sudo apt install build-essential cmake python3-dev

step6:
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer
错误提示1:

Unable to find cmake executable in any of ['cmake3', 'cmake']. CMake is required to build ycmd

解决方法:

sudo apt install cmake

错误提示 2:

ERROR: Python headers are missing in /usr/include/python3.8

解决方法:

sudo apt-get install python3-dev

错误提示3

Generating ycmd build configuration...-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:20 (project):
  No CMAKE_CXX_COMPILER could be found.

解决方法:

sudo apt-get update
sudo apt-get install -y build-essential

错误提示4:

Traceback (most recent call last):
  File "/home/guojia/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 1165, in BuildWatchdogModule
    import setuptools # noqa
ModuleNotFoundError: No module named 'setuptools'

解决方法:

wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
tar -xvf setuptools-19.6.tar.gz
sudo python3 setup.py build

错误提示5:

/usr/bin/python3: can't open file 'setup.py'

解决方法:

step7:

python3 install.py --clangd-completer

python3 install.py

效果展示

syntax complete

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值