Vim - CPPComplete: CC ++ and Java Code Completion

xiaoxiao2021-03-06  21

http://www.vim.org/scripts/script.php?script_id=527

CPPComplete: C / C and Java Code Completion

Script Karma Rating 179/76, Downloaded by 5947

created byPeter Puck script typeutility descriptionThis plugin helps you complete things like: variableName.abc variableName-> abc typeName :: abc from the members of the struct / class / union that starts with abc If you just type abc will the script complete it with. the names that starts with abc and ignore any current scope The default key mapping to complete the code are:.. Alt l in insert mode will try to find the possible completions and display them in a popup menu Also normal completions to the names in cppcomplete.tags. Alt j in insert mode will show the popup menu with the last results. Selecting one of the items will paste the text. F8 / F9 will work in a similar way as Ctrl N, Ctrl P in unextended vim so the script can be used without the popup menu. F5 in insert mode will lookup the class and display it in a preview window The key mapping are only tested under Windows and linux and they will not work on all platforms. Changing the mappings is easy The Plugin Is Depending on That exuberant ctags has generated a tags file called cppcomplete.tags with the same options as in the following example: ctags -n -f cppcomplete.tags --fields = ai --C - types = p * The script has a command called generateTags that executes the above ctags command The tag file cppcomplete.tags is local to the script so you can use other tag files without affecting cppcomplete Java users do not need the --C -... types flag For C / C

can the script generate the cppcomplete.tags from the included files for you. This is based on vims checkpath function. The path must be set correct, see the vim documentation. This script do not requires grep anymore but it is supported. If the option is set to build an internal list with derived classes and the first completion takes a very long time may grep speed things up. For Windows does the DJGPP port of grep works. You only need grep.exe from the grep'version'b.zip . file A good place for grep.exe could be the compilers bin directory The zip file is in the v2gnu directory, it can be downloaded from here:. http://www.delorie.com/djgpp/getting.html It is possible . to define a set of lines from cppcomplete.tags with regular expressions I call the set for a block The functions for this:.. BuildBlockFromRegexp the command to build the block, see below NextInBlock jump to the line described in the block, can be Called by Shift F8 Previnblock Same As The Above But in The Other Direct . Ion, use Shift F9 EchoBlock shows the block itself BuildMenuFromBlock builds a menu in GUI mode from the block The jumps are done with an internal function so the tag stack will not be affected Some simple examples there> is the prompt:> class: L Gives a Block with all members That Has A Scope of a class beginning with l> ^ a. * / ts / t all structures beginning with an a>

^ / (A / | B / | C) EVERYTHING THATS with A, B OR C The Full Vim History Mechanism Can Be Used. The Script Has A Number of Variables That Can Be Set from The Menu In The GUI or Wildmenu Versions. They are at the top of the script file with descriptions if you want to change them more permanent. For Java do you probably want to generate a cppcomplete.tags file from the sources of the Java SDK. The use is like with C / C but you will get a better result if you change some of the configuration variables. The default access is treated as if it was public. If you are new to vim and have not heard about ctags, regexp, grep are they all described in the online documentation . Just type:... help followed by the word you want more information about They are excellent tools that can be used for many things BUGS / Features This plugin does not really understand any C / C code, it is not a real parser It Works surprisingly Well But Can of Course Give a surprising result. :) The current scope is unknown. Multidimensional arrays shop NOT HAVE A Space Between] [, EG XYZ [1] [2] .ABC Should Be Ok But Not XYZ [1] [2] .ABC The Script Does Not Accept Functions, EG XYC () -> ABC WILL not be completed or rather it will be completed but from all names beginning with abc. (GTK) If the mouse leaves and then reenters the popup menu is the text cursor affected. (GTK) The popup is displayed at the mouse position and not the TEXT CURSOR POSITION. for INTERNAL USE IS Register C Used. Requires Exuberant CTags. The Only Tested Platforms for the Popup Menu Are GTK (Linux) and Windows.

转载请注明原文地址:https://www.9cbs.com/read-43275.html

New Post(0)