Vim code prompt plugin YouCompleteMe installation and configuration

introduce

For C/C++ program writing under Vim, if there is a code prompt plug-in, the writing efficiency will be greatly improved. Large IDEs are used a lot, and S&E, which has just returned to Vim, is more dependent on this. Just YouCompleteMe can meet his related needs. Simply record the installation and configuration process here for future recall.

In addition to C/C++, YouCompleteMe supports Java, Go, C#, Objective-C, CUDA, etc., which can be said to be relatively powerful. But in other words, why use Vim to write Java? IDEA seems to be better.

After using it, I found that this plugin also supports operations such as code jumping, reference lookup, function name modification and format adjustment, which is quite convenient.

Giuhub warehouse address:https://github.com/ycm-core/YouCompleteMe

Preconditions

To install the latest YouCompleteMe plugin you need to meet some conditions

  • Vim 8.1 or above and Python3 extended support is enabled (this site has a process record,click here to view)
  • GCC 8+ or Clang 7+
  • When compiling Python 3.6 and above, there is the --enable-shared option (generally included with package manager installations)

For Debian 10, the version of Gcc installed via the package manager is 8.3.0.

Then you can check the compiler version with the following command

% cc -v

For python3 version, use the following command to view

% python3 --version

For Vim version, execute the following command to view

% vim --version

After checking the above dependencies, also execute the following command to confirm the installation of related dependencies

% sudo apt install build-essential cmake vim-nox python3-dev

Install

First make sure you have installed YouCompleteMe with the Vim plugin manager, it is recommended to useVundle.

After confirming that YouCompleteMe is installed, follow the steps below

If you want to install all the functions, including Java (JDK 8), Go, C# and other code prompt functions, you can directly execute the following command to install

% cd ~/.vim/bundle/YouCompleteMe % python3 install.py --clangd-completer

If you only want to use the C/C++ code hinting function, execute the following command

% cd ~/.vim/bundle/YouCompleteMe % python3 install.py --clangd-completer

 

zh_CNZH-CN