Recently, I used Vim to write Python under Linux. Vim is known as the god of editors, and the code writing is also 6 high. It looks like a kind of superior feeling without mouse and keyboard operation, but the fly in the eye is that ViM does not auto-complete, which is certainly a big surprise for those who are used to IDE. So I checked all kinds of information, and finally, step by step, I configured YouCompleteMe in Ubuntu, which is known as the most difficult autocomplete plug-in to install in history. YouCompleteMe is a very useful auto-completion plug-in in Vim, which supports automatic completion in many languages. Using VIM with YCM is like adding wings to a tiger. Next, I will show you how to configure YCM in Linux.
git
cmake
Vundle
git
First, check whether you have Git installed on your system. Git is pre-preparation work, so that you can use this tool to download the source code of Vundle and Youcomplete on Github
The git versionCopy the code
If you did not find the git version, enter the following command:
sudp apt-get install git
Copy the code
Once the progress bar is complete, Git will be successfully installed on your system. BTW, remember to connect.
cmake
In the same way, check to see if cmake is installed on the system. If not, an error will be reported during the last part of the build. Again, type in terminal:
sudo apt-get install cmake
Copy the code
Vundle
In this step, we will use git tools. Enter the following command in the terminal:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Copy the code
Wait for system Clone to complete. Enter the command:
cd ~
Copy the code
Go to the home directory
Enter the command:
gedit .vimrc
Copy the code
Edit the configuration file and add the following code at the beginning of the file:
setNocompatible "Required FileType off" Required "The runtime path is set to include Vundle and initializedset rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()"Make Vuldle manage yourself Plugin 'VundleVim/ vundle.vim'" and finally write the position of the YouCompleteMe management statement. "All your plug-ins must add Call Vundle before this line# end () "is requiredFiletype plugin indent on "RequiredCopy the code
Start vim and type:
:PluginInstall
Copy the code
Note: case sensitive
YouCompleteMe
Enter the following command
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
Copy the code
First go to the YouCompleteMe directory:
cd ~/.vim/bundle/YouCompleteMe
Copy the code
Enter the following command:
Git submodule update -- init --recursiveCopy the code
This process may take a few minutes, and when the tape is complete, start compiling all the languages supported by YCM:
. / install. Py - allCopy the code
The compilation process is also slow, so please be patient. After compiling, add to the.vimrc file:
The Plugin 'VundleVim/YouCompleteMe'Copy the code
The location to add is given above. Now open vim and create a new file. If you have typed the code once, you will already have the completion function. Some methods and variables in the Python standard library can be completed. Reference links:
YCM
Vunlde