vim中安装youcompleteme插件

分两种情况

一、vim版本需要大于7.4.1578,并且支持python3,此种情况本人还没遇到,但可通过以下方法查看条件是否符合

1、进入vim,输入命令:version

2、进入vim,输入命令:echo has('python3')

 

二、不符合以上条件的

(一)、编译安装vim,步骤如下

1、安装依赖库

yum install -y ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed gcc ncruses-devel

2、移除vim组件

yum remove vim*

3、克隆

git clone https://github.com/vim/vim.git

 4、配置

./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local

make VIMRUNTIMEDIR=/usr/local/share/vim/vim81

 

5、make && make install

6、git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

7、编辑.vimrc

set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"
" " The following are examples of different formats supported.
" " Keep Plugin commands between vundle#begin/end.
" " plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" " plugin from http://vim-scripts.org/vim/scripts.html
" " Plugin 'L9'
" " Git plugin not hosted 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'
" " 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/'}
" " Install L9 and avoid a Naming conflict if you've already installed a
" " different version somewhere else.
" " Plugin 'ascenator/L9', {'name': 'newL9'}
"
" " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required

" " To ignore plugin indent changes, instead use:
" "filetype plugin on
" "
" " Brief help
" " :PluginList - lists configured plugins
" " :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean - confirms removal of unused plugins; append `!` to
" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line

8、进入vim,输入:PluginInstall安装,输入:PluginClean删除

转载于:https://www.cnblogs.com/Treelight/p/11155461.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Vim YouCompleteMe插件安装步骤如下: 1. 安装Vundle插件管理器,可以通过以下命令进行安装git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 2. 在.vimrc文件添加以下内容: set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " YouCompleteMe插件 Plugin 'Valloric/YouCompleteMe' " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required 3. 打开Vim,运行以下命令进行插件安装: :PluginInstall 4. 安装完成后,进入YouCompleteMe插件目录,运行以下命令进行编译: cd ~/.vim/bundle/YouCompleteMe ./install.py --clang-completer 5. 编译完成后,重新打开Vim即可使用YouCompleteMe插件。 ### 回答2: Vim YouCompleteMeVim编辑器的一个强大的自动补全插件,它可以在你输入时提供不同类型的自动完成选项,如变量名、函数名、类名等。它支持多种编程语言,包括C、C++、Python、JavaScript等。下面是如何安装YouCompleteMe插件。 1.安装vim插件管理器Vundle:从https://github.com/VundleVim/Vundle.vim下载最新的Vundle源代码。将下载的文件解压,并将其放置在~/.vim/bundle/Vundle.vim目录下; 2.加载YouCompleteMe插件:在vim配置文件(.vimrc),添加以下代码: `set rtp+=~/.vim/bundle/Vundle.vim` `call vundle#begin()` `Plugin 'Valloric/YouCompleteMe'` `call vundle#end()` 3.编译YouCompleteMe插件:执行以下命令来编译YouCompleteMe: `cd ~/.vim/bundle/YouCompleteMe` `./install.py --clang-completer`(如果你想支持其他语言,可以在安装时使用其他的选项) 4.重启Vim:重新启动Vim。 5.开启YouCompleteMe插件:在命令模式下,执行以下命令来开启YouCompleteMe插件: `:PluginInstall` 6.设置YouCompleteMe插件:在vim配置文件(.vimrc),添加以下代码来设置YouCompleteMe插件: `let g:ycm_min_num_of_chars_for_completion=2` `let g:ycm_autoclose_preview_window_after_completion=1` `let g:ycm_collect_identifiers_from_tags_files=1` `let g:ycm_complete_in_comments_and_strings=1` 以上是YouCompleteMe插件安装步骤及设置方法,希望对您有所帮助。 ### 回答3: 1. 安装vim 在开始安装youcompleteme插件之前,必须确保vim已经被正确地安装在您的电脑上。对于Ubuntu和Debian用户,可以使用以下命令来安装: ``` sudo apt-get install vim ``` 2. 安装Vundle Vundle是一个用于管理vim插件的工具。在安装youcompleteme之前,我们需要先安装Vundle。可以使用以下命令来安装: ``` git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim ``` 3. 安装youcompleteme 安装youcompleteme需要先确保一些依赖项已经被安装在您的电脑上。对于Ubuntu和Debian用户,可以使用以下命令来安装: ``` sudo apt-get install build-essential cmake python-dev python3-dev ``` 在安装完这些依赖项之后,我们需要进入vim并使用Vundle安装youcompleteme插件。 首先,在命令行上输入vim并按回车键,进入vim。 其次,在vim,按下"Esc"键来进入命令模式。 然后,输入以下命令,以从您的vimrc文件安装youcompleteme插件: ``` :PluginInstall ``` 在您输入该命令后,Vundle将开始下载并安装youcompleteme插件。此时需要安装插件的依赖项,输入以下命令: ``` cd ~/.vim/bundle/YouCompleteMe python install.py --clang-completer ``` 这将花费一些时间来完成youcompleteme插件安装。 4. 配置youcompleteme 安装youcompleteme后,您需要在.vimrc文件进行一些配置。例如,您可以设置允许youcompleteme在打开文件时立即启动自动补全。添加以下设置: ``` autocmd InsertEnter * if !&completefunc | setlocal completefunc=YouCompleteMe\|UltiSnips#Complete | endif ``` 完成上述步骤后,youcompleteme插件将在您的vim运行,让您更加高效地进行编码工作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值