ubuntu 16.04 configuring the YouCompleteme plug-in

Posted by djot on Sun, 15 Dec 2019 21:18:34 +0100

This thing has been killing me for several days, and it has worked out. It's not bad. I'm here to record my method and hope to help the people behind me.

1. Delete the original vim package

sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common

2. Installation dependency

vim dependence

sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev libperl-dev libncurses5-dev ruby-dev

If necessary, delete the previously compiled vim installation file

// Clean and prepare folders
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim

3. Compile and install vim

git clone https://github.com/vim/vim
cd vim
./configure --with-features=huge \
            --enable-largefile \
            --enable-multibyte \
            --enable-fail-if-missing \
            \
            --enable-rubyinterp \
            --with-ruby-command=$(which ruby) \
            --enable-pythoninterp \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
            --enable-perlinterp \
            --enable-luainterp \
            --with-luajit \
            --enable-gui=auto --enable-cscope
make
sudo make install

Then vim is installed successfully. You can tap vim on terminal to try. If there is any reaction, the installation is successful.

 

4. Install vundle

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cd ~
touch .vimrc
vim ~/.vimrc

Add the following to the top of vimrc:

set nocompatible " be iMproved, required
filetype off " required
set backspace=indent,eol,start
" 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'

" install youcompleteme
Plugin 'Valloric/YouCompleteMe'

" 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
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'

5. Install YouCompleteMe

sudo apt install build-essential cmake clang
git clone --recursive https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --system-libclang

The source file of youcompleteme is a little bit large. It takes a long time and needs to wait.

Then after these are done, create a file to test the NiuDao

touch test.cpp

When you write c + + code, you find that you are prompting some library files. If not, please pay attention to the

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'

Whether the path is correct or not. My tutorial is here. Although it is simple, I have suffered a lot.

 

Reference

[1]. Compile and install vim/gvim 8.0 under Ubuntu 16.04 http://mikewootc.com/wiki/linux/usage/ubuntu_make_vim80.html

[2].Ubuntu 16.04 + vim8 + vundle + YouCompleteMe.http://blog.51cto.com/walkerqt/1935024

 

Topics: vim git sudo github