vim 安装YouCompleteMe 插件

编程入门 行业动态 更新时间:2024-10-24 06:34:22

vim 安装YouCompleteMe <a href=https://www.elefans.com/category/jswz/34/1771202.html style=插件"/>

vim 安装YouCompleteMe 插件

原文链接:+youcompleteme/

 

 

要安装YouCompleteMe ,vim须支持python。可以命令输入vim --version 查看, 如果python前有+号,就是支持,减号就是不支持。

如果不支持,需要以编译安装方式重新安装vim。

编译配置选项:

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

 

安装vundle插件

git clone .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 .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 进行自动安装

+号表示已经安装,>表示正在安装;


在.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文件

 

重启vim之后出现需要更高版本的vim,需要先升级vim,

首先,要下载vim的源代码。

cd ~

git clone .git

cd vim

 进入源代码的src目录中,执行:
./configure --with-features=huge --enable-pythoninterp=yes --enable-cscope --enable-fontset --enable-perlinterp --enable-rubyinterp --with-python-config-dir=/usr/lib/python2.7/config --prefix=/usr/local
需要注意的是,不能写上--enable-gui,这是开启gui特性的,但是我们是在终端环境下安装的,因此不能开启这个特性,否则会出现编译错误。之后

cd ..

sudo make install

which vim

将src目录下编译好的vim执行文件替换上边which vim路径内的vim文件就升级ok了;

 

 

转载于:.html

更多推荐

vim 安装YouCompleteMe 插件

本文发布于:2023-06-29 03:44:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/938558.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   vim   YouCompleteMe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!