Linux系统Vim编辑器如何安装YouCompleteMe插件?
linux  /  管理员 发布于 7年前   129
编译配置选项:
/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来说相当重要。
123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..路人 在
php中使用hyperf框架调用讯飞星火大模型实现国内版chatgpt功能示例中评论 教程很详细,如果加个前端chatgpt对话页面就完美了..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号