Install this plugin because some of the wrong operation cost a lot of time, the process is recorded, later need to install to avoid wasting time.
Some preparatory work:
1. First install VIM:
1 sudo Install VIM-GTK
2. After the installation is complete, view the VIM support for Python
1 grep python
It was found that there was support for Python3 and no support for Python2.
If you need to switch to Python2 support, you can install the PY2 package:
1 sudo Install Vim-nox-py2
Once the installation is complete, check again to see if you can now switch to Python2 support.
If you need to switch, you can enter the command:
1 sudo update-alternatives--config vim
Enter the number to switch on.
3. Install the CMake and Python-dev as stated on the official documentation.
1 sudo Install build-essential CMake2sudoinstall Python-dev Python3-dev
Installing Youcompleteme
1. First install Vim's extension Manager vundle and use Vundle to install YCM.
1 git clone https://github.com/gmarik/vundle.vim.git ~/.vim/bundle/vundle.vim
After the installation is complete, you can install the Vundle official documentation to configure the. vimrc file.
SetNocompatible "Be improved, requiredfiletype off"Required"set the runtime path to include Vundle and Initializeset Rtp+=~/.vim/bundle/vundle.vimcall vundle#begin ()"Alternatively, pass aPathwhere Vundle should install plugins"Call vundle#begin (' ~/some/path/here ')"Let Vundle manage Vundle,Requiredplugin ' Vundlevim/vundle.Vim '"The following is examples of different formats supported."Keep Plugin commands between vundle#begin/End."All of your Plugins must be added before the following Linecall Vundle#end ()"Requiredfiletype Plugin Indent on"Required"To ignore plugin indent changes, instead Use:"FileType plugin on
Then use the: Plugininstall command to start managing with Vundle.
Add begin/end between Add Plugininstall ' Valloric/youcompleteme ', save, then execute command: Plugininstall can start installing Youcompleteme.
But I often get stuck in the download, and it will take a long time.
Therefore, it is recommended to download directly under ~/.vim/bundle/.
1 git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle 2 git Clone https://github.com/valloric/youcompleteme.git ~/.vim/bundle/youcompleteme 3 CD ~/.vim/bundle/youcompleteme 4 git submodule update--init--recursive
After the download is complete, add plugininstall ' Valloric/youcompleteme ', save, then execute the command: Plugininstall can be completed in an instant.
After the download is complete, you can choose what languages you want to support, and if you need to add C language support, you can execute the command:
1 cd ~/.vim/bundle/youcompleteme2 ./install. PY--clang-completer
The clang is automatically downloaded for follow-up, but it takes longer to execute, so you can download the installation clang yourself first.
1 sudo Install Clang
And then use the system--system-libclang
1 ./install. PY--clang-completer--system-libclang
If all is required, you can execute the following command:
1 cd ~/.vim/bundle/youcompleteme2 ./install. PY--all
Note that xbuild, go, tsserver, node, NPM, and cargo must be guaranteed to be installed.
Configure YCM
After the installation is complete, you will also need to configure the YCM. Written in the official documentation
YCM looks for A. ycm_extra_conf.py file in the directory of the opened file or in any directory above it in the hierarchy (recursively); When the file is found, it's loaded (only once!) as a Python module.
You can find the. ycm_extra_conf.py file under ~/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/, which can be copied to the current directory each time you use it, or in ~/. Configuration in the VIMRC.
1 Let g:ycm_global_ycm_extra_conf = ' ~/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/.ycm_ extra_conf.py ' " Configure global path 2 let g:ycm_confirm_extra_conf=0 " each time you load the file directly, you are not prompted to load
To complement the whole language, modify the. ycm_extra_conf.py:
Under Flags to add
1 '-isystem',2 '/usr/include',3 '-isystem',4 'usr/include/c++/5.4.0'5 '-isystem',6 'usr/include/x86_64-linux-gnu/c++',
and comment out this paragraph:
1 Try: 2 ' -stdlib-libc++ ' )3except ValueError:4 Pass
Other configurations and configurations in the ~/.VIMRC can be tailored to your personal preferences.
You can use it here, ycm.
Ubuntu16.04 Installing the Youcompleteme plugin for vim