Previously recorded in OneNote feel a bit messy, and not suitable to save the shell, this reinstallation and problems, simply write a blog record.
Start from scratch
1. Git (used to download vim and related plugins)
sudo apt-get install git
2, CMake (used to compile CLANG-LLVM)
sudo apt-get install build-essential cmake
3, VIM, here manually compiled vim, because the need for Python support, direct apt-get words will encounter a lot of trouble
Process Reference Https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
Install dependencies First, note that Ubuntu 16.04 is liblua5.1-dev and not Lua5.1-dev
sudo apt-get install Libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev Libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 Liblua5.1-dev Libperl-dev git
If you already have vim, you need to remove it.
sudo apt-get remove vim vim-runtime gvimsudo apt-get remove Vim-tiny vim-common vim-gui-common Vim-nox
Then there is the special thing about Ubuntu, if you want to use Python, the configuration directory may have a machine-related name, mine is
So my configuration parameters are as follows:
CD ~git clone Https://github.com/vim/vim.gitcd vim./configure--with-features=huge --enable-multibyte -- Enable-rubyinterp=yes --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86 _64-linux-gnu --enable-python3interp=yes --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_ 64_linux-gnu --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2--enable-cscope-- Prefix=/usrmake Vimruntimedir=/usr/share/vim/vim80
And then it installs directly
CD ~/vimsudo make install
Instead, uninstall needs to keep the Vim folder and install Checkinstall
sudo apt-get install CHECKINSTALLCD ~/vimsudo checkinstall
After successful installation, open vim, Command mode input: Echo has ("Python") | | Has ("Python3"), the result is that 1 represents success.
Previous time due to no configuration changes for Ubuntu 16.04, resulting in vim support not installed, although Vim--version | The python shown in grep python is actually preceded by a plus sign.
4. Vundle (used to manage vim plugin)
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/vundle.vim
As for the contents of. VIMRC See original address Https://github.com/VundleVim/Vundle.vim
Add Plugin ' valloric/youcompleteme ' between Vundle begin () and end () in. VIMRC, then vim command: Plugininstall
Because the youcompleteme has about 223M, so you need to wait patiently, you can occasionally use the command du-s ~/.vim/bundle/youcompleteme to observe the folder size.
5, Direct installation ycm
./install.py--clang-completer
It will automatically download clang 3.9.0, or manually to http://releases.llvm.org/download.html download precompiled binary files, love toss can be directly under the source, and then CMake compiled.
YCM installation is complete, now add the following in. VIMRC (refer to blog http://www.mikewootc.com/wiki/tool/sw_develop/vim_ycm_ubuntu_1604.html here)
"Youcompletemeset Runtimepath+=~/.vim/bundle/youcompletemelet g:ycm_collect_identifiers_from_tags_files = 1" Open The YCM-based tag engine let g:ycm_collect_identifiers_from_comments_and_strings = 1 "comment and the contents of the string are also used for the complement let g:syntastic_ignore_files= [". *\.py$"]let g:ycm_seed_identifiers_with_syntax = 1 "syntax keyword completion let g:ycm_complete_in_comments = 1let g:yc m_confirm_extra_conf = 0let g:ycm_key_list_select_completion = [' <c-n> ', ' <Down> '] "map button, no this will intercept tab, resulting in other The tab of the plugin is not available. Let g:ycm_key_list_previous_completion = [' <c-p> ', ' <Up> ']let g:ycm_complete_in_comments = 1 "Let G:ycm_complete_in_strings = 1" In note input can also complement let g:ycm_collect_i in string input Dentifiers_from_comments_and_strings = 1 "comments and text in the string will also be earned by the g:ycm_global_ycm_extra_conf= ' ~/.vim/bundle/ youcompleteme/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py ' Let g:ycm_show_diagnostics_ui = 0 ' disabled Grammar check inoremap <expr> <CR> pumvisiBLE ()? "\<c-y>": "\<cr>" | "Enter to select the current item Nnoremap <c-j>: Ycmcompleter gotodefinitionelsedeclaration<cr>| "Jump to Definition" let g:ycm_min_num_of_chars_for_completion=2 start listing matches from the 2nd type of character
The key is the configuration file. ycm_extra_conf.py, which contains the complete system header file and source file origin.
To add the directories that need to be included here, just modify the flags
To here the basic YCM is configured, Ctrl+space popup completion object, ctrl+j jump to the definition, here temporarily only add the standard library, because some functions are a layer of calls, if you want to see the bottom implementation, you can learn the use of ctags, After all, the biggest advantage of YCM is that it can be edited very smoothly at the same time, including too many may cause the completion of the complete slow.
and. ycm_extra_conf.py can be configured in the current directory, YCM is first in the current directory to find and then go online until it is recursive to find, and will only be loaded once.
For more information, refer to the original address https://github.com/snakeleon/YouCompleteMe-x86
Ubuntu 16.04 64-bit installation Youcompleteme