也想出现在这里? 联系我们

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

作者 : 小编 本文共2664个字,预计阅读时间需要7分钟 发布时间: 2022-11-2 共3.18K人阅读
也想出现在这里? 联系我们

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’

  ”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

  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来说相当重要。

1. 本站所提供的源码模板(主题/插件)等资源仅供学习交流,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担,有部分资源为网上收集或仿制而来,若模板侵犯了您的合法权益,请来信通知我们(Email: rayer@88.com),我们会及时删除,给您带来的不便,我们深表歉意!
2. 分享目的仅供大家学习和交流,请不要用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布投稿,分享有金币奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务 请大家谅解!
5. 如有链接无法下载、失效或广告,请联系站长,可领回失去的金币,并额外有奖!
6. 如遇到加密压缩包,默认解压密码为"www.zyfx8.cn",如遇到无法解压的请联系管理员!
本站部分文章、资源来自互联网,版权归原作者及网站所有,如果侵犯了您的权利,请及时联系我站删除。免责声明
资源分享吧 » Linux系统Vim编辑器如何安装YouCompleteMe插件?

常见问题FAQ

免费下载或者VIP会员专享资源能否直接商用?
本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
织梦模板使用说明
你下载的织梦模板并不包括DedeCMS使用授权,根据DedeCMS授权协议,除个人非盈利站点外,均需购买DedeCMS商业使用授权。购买地址: http://www.desdev.cn/service-dedecms.html

发表评论

Copyright 2015-2020 版权所有 资源分享吧 Rights Reserved. 蜀ICP备14022927号-1
开通VIP 享更多特权,建议使用QQ登录