Linux系统Vim安装YouCompleteMe插件教程详解
时间:2023-04-28 18:08:43
LINUX相信很多用户都很少接触到,而技术人员或是IT人士就会经常接触。而在Linux系统中想要让Vim编辑器发挥更大的作用,就要对给给它安装一些插件。比如说YouCompleteMe插件(名字就很形象)。下面,小编就给大家介绍Linux系统Vim安装YouCompleteMe插件教程详解。
Linux系统
编译配置选项:
。/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 进行自动安装
[page]
进程如下,+号表示已经安装,》表示正在安装。
。 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文件
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Safari浏览器起始页怎么设置背景?
![](https://img.aspxhome.com/file/2023/7/a207147_0s.jpeg)
Excel中如何输入前面带0的数字?
![](https://img.aspxhome.com/file/2023/9/a141249_0s.jpg)
win10系统安全模式用法简介
![](https://img.aspxhome.com/file/2023/8/46778_0s.jpg)
Win11连接宽带的具体步骤
![](https://img.aspxhome.com/file/2023/1/a278975_0s.jpg)
XP系统如何优化系统配置实用程序
![](https://img.aspxhome.com/file/2023/4/a305885_0s.jpg)
在excel表格中的最左边怎么做目录式?
![](https://img.aspxhome.com/file/2023/2/41862_0s.jpg)
windows系统提示Intfaced not supporded的解决方法
![](https://img.aspxhome.com/file/2023/29/a252287_0s.jpg)
Win10此设备不支持接收Miracast无法投影怎么办?
![](https://img.aspxhome.com/file/2023/1/a272122_0s.png)
Win10系统NET3.5安装不了出现错误代码0x800f0950如何解决?
![](https://img.aspxhome.com/file/2023/4/a307893_0s.jpg)
wps表格如何删除打印预览分割线
扩容U盘还原成实际容量的方法
![](https://img.aspxhome.com/file/2023/2/a284501_0s.png)
excel 2013中编辑工作表的方法
![](https://img.aspxhome.com/file/2023/4/a154664_0s.png)
WPS excel多种方式设置货币符号
![](https://img.aspxhome.com/file/2023/5/a185175_0s.png)
wps如何向形状添加文本
![](https://img.aspxhome.com/file/2023/4/a170754_0s.jpg)
PPT如何制作粉笔字体效果的文字?PPT制作粉笔字体的方法
![](https://img.aspxhome.com/file/2023/10/a350151_0s.jpg)
电脑如何重装Win11系统?石大师重装系统Win11方法
![](https://img.aspxhome.com/file/2023/1/a272851_0s.png)
excel数据透视表:计算车辆停放的时长
![](https://img.aspxhome.com/file/2023/7/a142777_0s.jpg)
wps忘记保存怎么办?
![](https://img.aspxhome.com/file/2023/9/a168889_0s.gif)
Win10系统找不到gpedit.msc怎么办?
![](https://img.aspxhome.com/file/2023/25/a218662_0s.jpg)
电脑屏幕太亮太刺眼了怎么调整
![](https://img.aspxhome.com/file/2023/6/a324122_0s.png)