ubuntu下vim安装YouCompleteMe教程

ubuntu16.4下vim安装YouCompleteMe教程

YouCompleteMe 是vim代码提示插件


1 首先检查vim版本

vim --version

如下所示

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
-clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             -perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"

确认vim 版本至少 7.4 Included patches 大于 1578 并且在vim中 输入

:echo has('python') || has('python3')**

如图所示

如果返回值为1 代表支持Python 如果为0 需获得支持Python的Vim版本。

2 在vim中安装Vundle

按照文章安装https://www.jianshu.com/p/769...

3 在使用Vundle安装YouCompleteMe

在.vimrc中添加以下内容

Plugin 'Valloric/YouCompleteMe'

clipboard.png

然后执行如下

git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle

在 ~/.vim/bundle/YouCompleteMe 目录下执行

git submodule update --init --recursive

4 安装cmake

apt install cmake

5 YouCompleteMe 要求clang至少7.0 所以编译libclang 8.0

clang --version

按照文章编译https://blog.csdn.net/xingyu9...

6 YouCompleteMe目录下 安装c语言代码提示

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

如图所示表示编译成功

编译成功.png

添加.vimrc配置

vi .vimrc
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'

然后随意创建 .c文件测试提示

clipboard.png

0 声望
1 粉丝
0 条评论
推荐阅读
使用netty实现文件上传服务器
使用netty实现文件上传服务器 代码实现根据官网提供的example [链接] 以及netty官网的api文档 [链接] 项目地址 [链接] 1 编写 server 启动类 {代码...} 2 绑定handler {代码...} 3 上传处理的handler {代码...} 4...

陈绪3阅读 8k

git/pip/easy_install/apt代理/源设置
在公司内网环境中,访问公网往往需要经过公司的代理,对于浏览器、IDE等开发工具,都提供了设置代理的配置,而git、pip、easy_install等CLI工具,则需要通过命令或配置文件进行代理设置;对于Python、Ubuntu、Mav...

乘着风1阅读 5.1k

Ubuntu20.04 从源代码编译安装 python3.10
Ubuntu 22.04 Release DateUbuntu 22.04 Jammy Jellyfish is scheduled for release on April 21, 2022If you’re ready to use Ubuntu 22.04 Jammy Jellyfish, you can either upgrade your current Ubuntu syste...

ponponon1阅读 4.5k评论 1

Ubuntu系统下的snmp安装配置
snmp(Simple Network Management Protocol,简单网络管理协议),该协议的实现以及应用是采用C/S模型的特殊模式:代理/管理站模型。

龚正阳阅读 1.5k

Harbor私有仓库搭建并配置https对接docker与kubernetes
默认情况下,Harbor 不附带证书。可以在没有安全保护的情况下部署 Harbor,以便您可以通过 HTTP 连接到它。在生产环境中,推荐始终使用 HTTPS。要配置 HTTPS,必须创建 SSL 证书。可以使用由受信任的第三方 CA 签...

李朝阳3阅读 1.1k

【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server
引言如标题所说,属于个人虚拟机安装Ubuntu的笔记记录。VM安装网络上有很多教程,这里就直接省略了。下载Ubuntu 22.04.1-server进入Ubuntu的中文网站:Ubuntu系统下载 | Ubuntu根据最新的版本下载即可。本次使用...

Xander阅读 940

k8s安装dashboard
一、环境介绍k8s版本:v1.22.2dashboard版本:v2.5.1安装前注意k8s的版本与将要安装的dashbaord版本是否兼容,具体查看[链接]二、dashbord安装下载官方yaml文件并且进行部署 {代码...} 查看dashbaord相关pod状态 ...

李朝阳2阅读 899

0 声望
1 粉丝
宣传栏