YouCompleteMe折腾配置以及clang+llvm编译安装

本文介绍了VIM编辑器的配置,重点是安装和配置YouCompleteMe插件以及编译安装clang+llvm。文章详细讲解了VIM的buffer、window、tab概念,以及必备插件如nerdtree、YouCompleteMe的用途。在安装YouCompleteMe时,强调了确保Vim版本、Python支持、libclang的下载和ycm_core库的编译。同时,提到了clang和LLVM的关系,以及如何编译安装clang+llvm。
摘要由CSDN通过智能技术生成

比较麻烦,未完待续。。。。。。

VIM

强调三个概念:

A buffer is the in-memory text of a file. 
A window is a viewport on a buffer.
A tab page is a collection of windows.

解释:
1. vim 把加载进内存的文件叫做 buffer,buffer 不一定可见;
2. 若要 buffer 要可见,则必须通过 window 作为载体呈现;
3. 同个看面上的多个 window 组合成一个 tab。
4. 一句话,vim 的 buffer、window、tab 你可以对应理解成视角、布局、工作区。

现在业内一般不建议用 tab,因此这里重点关注 buffer、window。

列出 增加 删除 选择/切换 退出 其他
buffer :ls
:buffers
:e :bd :bNum
:bn :bp :bl :bf
tab :tabs :tabe :tabc
:tabo
gt/gT
:tabp
:tabn
window C-w +
C-w -
C-w >
C-w <
:new
:vnew
:q :qa :wqa :only
C-w =
C-w q
C-w c
C-w o
C-w C-w
C-w h/j/k/l
file & dired :Ex :Sex
:He :Ve
:Te
其他操作 命令 命令 命令 命令 命令 命令
其他 u gu guu
U gU gUU
C-c fChar *
viw
C-o
C-i
:shell
exit

配置:.vimrc以及.ycm_extra_conf.py配置

插件:个人觉得以下几乎是必需的插件

插件

  • vim-plug: 轻巧的插件管理器
  • nerdtree: scrooloose/nerdtree 目录结构浏览
  • YouCompleteMe: Valloric/YouCompleteMe 超级强大的自动补全,集成了具有语法检查功能的syntactic
  • tagbar: majutsushi/tagbar 相当于eclipse的outline
  • ctrlp: kien/ctrlp.vim 全局搜索+状态条
  • powerline: powerline/powerline
  • nerdcommenter:scrooloose/nerdcommenter
  • vim-expand-region:terryma/vim-expand-region
  • vim-surround:tpope/vim-surround
  • gtags : vim-scripts/gtags.vim 让 vim 可以用 gnu-global ,gtags 要结合 gtags-cscope 一起使用
  • gtags-cscope : whatot/gtags-cscope.vim

插件使用备忘

有些插件用法容易忘记,记录在这里

nerdtree

NERDTree可以很方便地进行打开文件、查找文件等操作,但是删除啊等等这些操作呢?见下图

这里写图片描述

nerdcommenter

注释:SPC c c
取消:SPC c u

安装YouCompleteMe

其他的插件都很好装,就是ycm不好装。

按照步骤来,一定能成功的。

如果哪里出错了,仔细从头地对照教程检查;如果每一步真的都是按照步骤来,一定可以成功。

安装Vundle

确保前提

Ensure that your version of Vim is at least 7.4.143 and that it has support for Python 2 or Python 3 scripting.

翻译: 确保Vim版本至少为7.4.143,并且它支持Python 2或Python 3脚本。

验证:

  1. 在Vim中输入 :version 可以查看版本。

  2. After you have made sure that you have Vim 7.4.143+, type the following in Vim: echo has('python') || has('python3'). The output should be 1. If it’s 0, then get a version of Vim with Python support.

    翻译: 确定Vim 7.4.143+后,在Vim中键入以下命令:echo has('python')|| has('python3'),输出应为1;如果它为0,那么去装一个带有Python支持的Vim版本。

安装YouCompleteMe插件

两种方式安装:

  1. Vundle安装:Plugin 'Valloric/YouCompleteMe'

    如果用Vundle更新YCM,yum_support_lib库API改变了,YCM会提醒你重新编译它。

  2. git安装:先用git clone --recursive https://github.com/Valloric/YouCompleteMe.git获取最新的仓库;而后使用git submodule update --init --recursive确认仓库的完整性后,开始安装流程

Download the latest version of libclang: 下载libclang(版本>=3.9)

翻译: 下载最新版本的libclang(3.9以上版本)

下载地址:http://llvm.org/releases/download.html

官方建议下二进制包:(别下错了)

  • Clang for x86_64 Ubuntu 14.04 (.sig)
  • Clang for x86_64 Ubuntu 16.04 (.sig)
  • Clang for Mac OS X (.sig)

编译安装ycm_core库之前戏

Compile the ycm_core library that YCM needs.
This library is the C++ engine that YCM uses to get fast completions.

翻译: 编译YCM需要的ycm_core库。 这个库是YCM用来获得快速完成的C ++引擎。

编译安装ycm_core需要cmakepython-dev支持。

安装cmake:

  • Ubuntu: sudo apt-get install cmake
  • Mac: brew install cmake

安装python-dev:

  • Ubuntu: sudo apt-get install python-dev python3-dev
  • Mac: they should already be present(Mac下,它们是现成的,不需要额外装)

Here we’ll assume you installed YCM with Vundle.
That means that the top-l

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值