vim auto-completion plugin YouCompleteMe

5. Code Smart Tips and Completion

When writing code, the intelligent prompting and completion functions of code symbols such as variable names, function names, and class names are very useful, which can greatly improve coding efficiency. However, before the advent of the magical plugin YouCompleteMe (YCM for short), vim has been using the tag mechanism to complete this function. Because tag only clumsily analyzes the strings in the code, and cannot recognize its syntax and semantics, the code prompts are not easy to use. With the advent of clang, developers can perform de facto semantic analysis of program code (calling clang analyzers and the like), so the real smart prompts and completion plug-ins appeared, which was developed by Google engineer Strahinja Val Markovic Developed by YCM ( https://github.com/Valloric/YouCompleteMe ).

5.1 Installation and configuration of YouCompleteMe

YCM is developed using C++ and python. It is a complex plug-in, and the file downloaded through Vundle alone reaches more than 120 MB. In addition, YCM not only has newly developed functions, it also contains some other useful plugins. The following picture is a demonstration animation suggested by the author himself:

In addition to code prompts and completions, with the powerful syntax and semantic analysis capabilities of libclang, YCM can also prompt error lines and error reasons when editing, as shown in the following figure:

In addition, YCM can also complete paths, file names, etc.

 

Installation and configuration steps:

  1. If you are on Ubuntu 14.04, run the following command to install
      
    sudo apt-get install vim-addon-manager
    sudo apt-get install vim-youcompleteme
    vim-addons install youcompleteme
    To install the YCM plugin, it's very simple. Otherwise go to 2.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325651667&siteId=291194637