Successful Transformation of VIM to powerful ide Series 3
"Plugin Introduction 』
Onmicppcompete function:
- Namespace, class, struct, Union
- Function attribute member and return value type completion
- "This" pointer member completion
- C/C ++ cast object completion
- Type Definition (typedef) and anonymous type (anonymous types) completion
The function prototype can be displayed, but I cannot. Why?
There is a picture with the truth:
"Download and install 』
From http://www.vim.org/scripts/script.php? Script_id = 1520 download the installation package.
1) Enter ~ /. Vim directory, decompress the installation version
2) Enter ~ /. Vim/doc directory. Run "helptags." In the vim command line ."
3) In ~ /. Add the following lines to vimrc:
set nocp filetype plugin on
4) After Vim is started, run the following command to add omnicppcomplete help information for vim.
:helptags ~/.vimrc/doc
5) Use ctags to generate the tag Library
For C ++ code ~ /. Add the following options to ctags (remove Chinese characters ):
-- C ++-kinds = + P: Add prototype information for the tag -- fields = + IAS: Add inheritance and access) information, function features (function signature, such as a parameter table or prototype) -- extra = + Q: Add a class ID for the class member label
So far, installation is complete!
"Basic Function usage 』
If Vim is configured and the ctags tag library is generated, the following completion prompt is displayed in VIM when "XXX." or "XXX->" is entered:
+-------------------------------------+
|method1( f + MyNamespace::MyClass|
|_member1 m + MyNamespace::MyClass|
|_member2 m # MyNamespace::MyClass|
|_member3 m - MyNamespace::MyClass|
+-------------------------------------+
^ ^ ^ ^
(1) (2)(3) (4)
1 indicates the symbolic name, 2 indicates the symbolic type, 3 indicates the access control identity, and 4 indicates the domain where the symbolic definition is located (scope ).
Symbol name
1 is the name of the optional Symbol (Symbol) found by omnicppcomplete. If it ends with '(', it is a function.
The prototype of the function can be displayed, but I cannot. Why?
Symbol type
The type of the symbol. The possible value is
- C: Class)
- D: Macro (macro definition)
- E: enumeator)
- F: Function)
- G: Enumeration type name
- M: Class/structure/Member Association (member)
- N: namespace)
- P: function prototype)
- S: Structure name)
- T: Type Definition (typedef)
- U: Union name)
- V: Variable defination)
Access Control
Access Control for class members; values:
- +: Public)
- #: Protected)
- -: Private)
Domain where the symbol definition is located
Where the symbol is defined.
"Common configuration options 』
In vim, you can use the following options to control the omnicppcomplete search/completion mode:
- Omnicpp_globalscopesearch: global search control. 0: Disabled; 1: allowed (default)
- Omnicpp_namespacesearch: namespace query control.
- 0: do not search for namespaces
- 1: Find the namespace in the current File Buffer (default)
- 2: Find the current File Buffer and the namespace in the included file
- Omnicpp_displaymode: class member display control (whether to display all public (private) Protection (protected) members ).
- 0: automatic
- 1: show all members
- Omnicpp_showscopeinabbr: the option is used to control the display position of the domain where the match is located. By default, the completion prompt menu displayed by Omni always displays the domain information of the matching item in the last column of the scaling information.
- 0: The domain where the matching item is located is not displayed in the Information scaling list (default)
- 1: display the domain where the matching item is located, and remove the last column from the scaling information.
- Omnicpp_showprototypeinabbr: whether the function prototype is displayed in the scaling information of the completion prompt.
- 0: not displayed (default)
- 1: Display prototype
- Omnicpp_showaccess: whether to display Access Control Information ('+ ','-','#'). 0/1. The default value is 1 (displayed)
- Omnicpp_defaultnamespaces: default namespace list, separated by commas.
For example, let omnicpp_defaultnamespaces = ["STD", "mynamespace"]
- Omnicpp_maycompletedot: Indicates whether to automatically run omnicppcomplete after. 0/1. The default value is 1.
- Omnicpp_maycompletearray: Indicates whether to automatically run omnicppcomplete after "->. 0/1. The default value is 1.
- Omnicpp_maycompletescope: Indicates whether to automatically run omnicppcomplete after the domain identifier. 0/1. The default value is 0.
- Omnicpp_selectfirstitem: whether to automatically select the first match. Valid only when "completeopt" is not "longest.
- 0: do not select the first item (default)
- 1: select the first item and insert it to the cursor position.
- 2: select the first item but do not insert the cursor position
- Omnicpp_localsearchdecl: Use the vim standard lookup function/local lookup function. In vim, the function used to search for variable definitions in the function must be in the first column of the text.
"Read instructions 』
1) Vim has multiple configuration files vimrc, such as/etc/vimrc. This file affects Vim of the entire system. And ~ /. Vimrc. This file only affects the user's vim. And ~ The configuration in the/. vimrc file overwrites the configuration in/etc/vimrc. Here we only modify ~ /. Vimrc file.
2) The Vim plug-in is installed in the runtimepath directory of VIM. You can run the "set RTP" command on the vim command line to view the plug-in. Here we choose to install in ~ /. Vim directory. If no directory exists, create one.
3) when this article says "run the cmdxx command under the vim command line", it means to run the cmdxx command in the command line mode of vim, in the normal mode of VIM, enter the colon ":" to enter the command line mode, and then enter the command running xx. The colon ":" is omitted in the subsequent description.
4) if "run a command under Vim command line" is not specified, the command is executed in shell.
5) If the command is left blank or contains characters that are easily confused with the body, I will use double quotation marks to distinguish the command from the body. Therefore, do not enter quotation marks at the beginning and end of the command during actual operations.
6) This article describes the combination of shortcut keys, in the form of a-B shortcut keys, that means to press the key and B key at the same time, and in the form of "A-B C" shortcut keys, it means to press the key and B key at the same time, then open the AB key, and then press the C key.
7) the system I use is ubunt 11.10, And the vim version is VI improved 7.3.