Linux系统Vim编辑器如何安装YouCompleteMe插件?linux怎么安装vim编辑器




Linux系统Vim编辑器如何安装YouCompleteMe插件?linux怎么安装vim编辑器

2022-07-20 20:26:19 网络知识 官方管理员
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插件

  gitclonehttps://github.com/gmarik/vundle.git~/.vim/bundle/vundle

  在.vimrc中配置

  setnocompatiblebeiMproved,required

  filetypeoffrequired

  settheruntimepathtoincludeVundleandinitialize

  setrtp+=~/.vim/bundle/vundle/

  callvundle#rc()

   alternatively,passapathwhereVundleshouldinstallplugins

  letpath=‘~/some/path/here’

  callvundle#rc(path)

  letVundlemanageVundle,required

  Plugin‘gmarik/vundle’

  Thefollowingareexamplesofdifferentformatssupported.

  KeepPlugincommandsbetweenhereandfiletypepluginindenton.

  scriptsonGitHubrepos

  Plugin‘tpope/vim-fugitive’

  Plugin‘Lok altog/vim-easymotion’

  Plugin‘tpope/vim-rails.git’

  Thesparkupvimscriptisinasubdirectoryofthisrepocalledvim.

  Passthepathtosettheruntimepathproperly.

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

  scriptsfromhttp://vim-scripts.org/vim/scripts.html

  Plugin‘L9’

  Plugin‘FuzzyFinder’

  scriptsnotonGitHub

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

  gitreposonyourlocalmachine(i.e.whenworkingonyourownplugin)

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

  。。。

  filetypepluginindentonrequired

  Bundle‘Valloric/YouCompleteMe’

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

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

  。Plugin‘gmarik/vundle’|~

  +Plugin‘tpope/vim-fugitive’|~

  +Plugin‘Lok altog/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!Witherrors;pressltoviewlog

  ycm_client_support.[so|pyd|dll]andycm_core.[so|pyd|dll]notdetected;youneed

  tocompileYCMbeforeusingit.Readthedocs!

  到.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中添加

  letmapleader=,这个leader就映射为逗号,

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

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

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

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

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


发表评论:

最近发表
网站分类
标签列表