900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > vim 安装YouCompleteMe 自动补全插件

vim 安装YouCompleteMe 自动补全插件

时间:2023-12-11 20:20:01

相关推荐

vim 安装YouCompleteMe 自动补全插件

原文链接://10/vim+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 /gmarik/vundle.git ~/.vim/bundle/vundle

在.vimrc中配置:

set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset 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, requiredPlugin 'gmarik/vundle'" The following are examples of different formats supported." Keep Plugin commands between here and filetype plugin indent on." scripts on GitHub reposPlugin '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-/vim/scripts.htmlPlugin 'L9'Plugin 'FuzzyFinder'" scripts not on GitHubPlugin 'git:///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" requiredBundle '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/vim/vim.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了;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。