Vim is a powerful editor that supports plug-ins. whether your system is Linux, UNIX, Mac, or windows, you can select it to edit files or perform engineering-level coding. If we can use Vim well, not only can the programming efficiency be greatly improved, but also people around us may feel dizzy and admired. Of course, we will feel very angry. Next let me introduce how to configure it. These configurations involve: autocomplpop, ctags, taglist, and omnicppcomplete.
First, VIM is built-in.CodeIt can be used without any settings. When you edit the code, press Ctrl + X, CTRL + O, CTRL + N, CTRL + P, and other shortcut keys to bring up the smart prompt menu. However, this still does not meet your requirements. In most ides, the completion prompt is automatically displayed as long as the code is input to the corresponding position, and VIM must manually trigger such completion. The following describes a plug-in that can automatically pop up the completion prompt-autocomplpop
= Autocomplpop =
First, from http://www.vim.org/scripts/script.php? Script_id = 1879 download autocomplpop. vim file (the vim plug-in is like this *. file in VIM format), and then put it into the plugin directory under the vim file directory (Unix/Linux platform in/usr/share/Vim/vim71, windows platform is in the vim71 directory of the installation directory). After you restart vim, a prompt is displayed automatically during encoding.
Careful friends will find that the use of the autocomplpop plug-in is far from meeting the requirements. For example, it is used in C ++. or-> when you access the members and functions of an object or pointer, the prompt cannot be displayed automatically. In addition, even the prompt can only prompt the strings that we have entered in the current document. In this case, we need to install the ctags tool and the omnicppcomplete plug-in. Ctags is a tool used to mark files. omnicppcomplete is an enhanced version of the above intelligent completion in the C and C ++ languages.
= Ctags =
After compiling and installing the ctags at http://ctags.sourceforge.net/download the source code. The General Mark command is ctags-R. "-R" indicates recursive creation, includingSource codeSource Under all subdirectories in the root directoryProgram.
= Cppcompleete =
Omnicppcomplete in http://www.vim.org/scripts/script.php? Script_id = 1520 download. After the download, install and use it according to the doc file.
In this way, Code Completion is complete. However, based on past experience, there is also a function in IDE, that is, jump viewing of functions and variables. For example
Code:
If (true ){
Dothis ();
}
We want to know how the dothis () function is defined and implemented, so how can we quickly view it? We need to install the taglist plug-in.
= Taglist =
Plug-ins in http://vim.sourceforge.net/scripts/script.php? Script_id = 273 download. After the download, we can install and configure it according to the doc document.
we found that the use of taglist also relies on the Tag file created by ctags. After the Tag file is created and all configurations are complete. We can press Ctrl +] to jump to a function or variable. Now you can use Vim for encoding like IDE.