Linux系统Vim编辑器如何安装YouCompleteMe插件?

2016-03-31 15:14 22 1 收藏

想不想get新技能酷炫一下,今天图老师小编就跟大家分享个简单的Linux系统Vim编辑器如何安装YouCompleteMe插件?教程,一起来看看吧!超容易上手~

【 tulaoshi.com - 服务器 】

Linux系统Vim编辑器如何安装YouCompleteMe插件?

Linux系统Vim编辑器如何安装YouCompleteMe插件? Linux系统Vim如何安装YouCompleteMe插件

  编译配置选项:

  /configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset

  在我的机器上装有python2.7.5 和 python3.3, 但加了enable-python3interp参数依然没有支持py3,不知何故,先不管,YouCompleteMe 只要求有py2.6以上。

  安装vundle插件

  git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

  在.vimrc中配置

  set nocompatible be iMproved, required

  filetype off required

   set the runtime path to include Vundle and initialize

  set rtp+=~/.vim/bundle/vundle/

  call vundle#rc()

   alternatively, pass a path where Vundle should install plugins

  let path = ‘~/some/path/here’

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/fuwuqi/)

  call vundle#rc(path)

   let Vundle manage Vundle, required

  Plugin ‘gmarik/vundle’

   The following are examples of different formats supported.

   Keep Plugin commands between here and filetype plugin indent on.

   scripts on GitHub repos

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/fuwuqi/)

  Plugin ‘tpope/vim-fugitive’

  Plugin ‘Lokaltog/vim-easymotion’

  Plugin ‘tpope/vim-rails.git’

   The sparkup vim script is in a subdirectory of this repo called vim.

   Pass the path to set the runtimepath properly.

  Plugin ‘rstacruz/sparkup’, {‘rtp’: ‘vim/’}

   scripts from http://vim-scripts.org/vim/scripts.html

  Plugin ‘L9’

  Plugin ‘FuzzyFinder’

   scripts not on GitHub

  Plugin ‘git://git.wincent.com/command-t.git’

   git repos on your local machine (i.e. when working on your own plugin)

  Plugin ‘file:///home/gmarik/path/to/plugin’

   。。。

  filetype plugin indent on required

  Bundle ‘Valloric/YouCompleteMe’

  保存退出,打开vim,输入 :BundleInstall 进行自动安装

  进程如下,+号表示已经安装,》表示正在安装

  。 Plugin ‘gmarik/vundle’ |~

  + Plugin ‘tpope/vim-fugitive’ |~

  + Plugin ‘Lokaltog/vim-easymotion’ |~

  + Plugin ‘tpope/vim-rails.git’ |~

  + Plugin ‘rstacruz/sparkup’ |~

  + Plugin ‘L9’ |~

  + Plugin ‘FuzzyFinder’ |~

  》 Plugin ‘git://git.wincent.com/command-|~

  t.git’ |~

  Plugin ‘file:///home/gmarik/path/to/pl|~

  ugin’ |~

  Plugin ‘Valloric/YouCompleteMe’ |~

  Helptags

  备注:结束时有个错误,这是正常的,因为ycm需要手工编译出库文件

  Done! With errors; press l to view log

  ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need

  to compile YCM before using it. Read the docs!

  到 .vim/bundle/YouCompleteMe 下

  /install.sh --clang-completer

  参数是为了支持c/c++ 的补全。

  安装完成后,进行一些简单的配置就可以使用。

  YouCompleteMe 的补全配置文件在/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py,这是个隐藏文件。

  默认会使用这个文件,也可以把这个文件copy到工程的根目录中作修改,打开工程文件时会优先使用当前目录下的配置文件。

  如果找不到,会根据配置中的ycm_global_ycm_extra_conf 进行查找。

  在.vimrc 中添加

  let mapleader = , 这个leader就映射为逗号,

  let g:ycm_global_ycm_extra_conf = ‘~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py’ 配置默认的ycm_extra_conf.py

  nnoremap 《leader》jd :YcmCompleter GoToDefinitionElseDeclaration《CR》 按,jd 会跳转到定义

  let g:ycm_confirm_extra_conf=0 打开vim时不再询问是否加载ycm_extra_conf.py配置

  let g:ycm_collect_identifiers_from_tag_files = 1 使用ctags生成的tags文件

  以上就是Linux给Vim安装YouCompleteMe插件的方法了,YouCompleteMe插件号称Vim自动补全神器,这个插件对Vim来说相当重要。

来源:https://www.tulaoshi.com/n/20160331/2050249.html

延伸阅读
标签: 电脑入门
★ 公式编辑器的来历 你一定知道在Word中有个公式编辑器应用程序,但你可能不清楚它其实不是微软公司开发的,它是Design Science公司的Mathtype公式编辑器特别版,是为Microsoft应用程序而定制的。 ★ 公式编辑器的安装 公式编辑器不是Office默认安装的组件,如果要使用它,重新安装Office至如图1所示步骤时,在Office工具中选择公式编辑器...
虾米编辑器如何使用   虾米编辑器使用帮助 歌曲、Flash、表情、超链接,随便来添加吧! 先让虾小米来示范一下吧: 先来用一下比较炫的添加歌曲功能,点击 按钮,在弹出窗口输入框中输入你要添加的歌曲名,点击搜索,选中歌曲,添加就可以了呢!如图: 歌曲添加完成了,加个表情吧来表达下心情吧。点: ,嘿嘿...
如何使用135编辑器   ▼135编辑器中的样式换色方式有:全文换色、部分换色 全文换色 1. ctrl+a,选中全文 2. 点击任意需要的颜色; 3. 编辑框中所有内容的颜色则全部换色(注:文字颜色需使用字体颜色来换色) 部分换色 1. 点击样式内的任意区域,出现虚线框 2. 点击中的颜色即可
注:续网友 hua 之后,网友 Linuxhero 在讨论区发布了他改进 hua 编写的编辑器程序,并消除了文件存储的乱码问题,本站测试了这个程序,效果不错,希望两位网友再接再励不断地把这个编辑器完善起来,同时也谢谢两位网友对非常空间的支持! ----------------------------------------------------------- 作者:linuxhero ...
Windows 7系统注册表编辑器如何打开?   注册表是Windows操作系统经典的配置功能,我们日常使用 的软件和系统存储设置大多保存在注册表中,有的同学不知道注册表编辑器怎么打开,还有的同学安装了Windows7操作系统,也来问编辑win7注册表编辑器怎么打开, 现在我们来回答一下这个问题。 在XP下和Win7下通用的打开方法: ...

经验教程

871

收藏

14
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部