sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

ProtoDef : Tool to help create skeleton implementations of c++ function prototypes

 script karma  Rating 156/48, Downloaded by 2434    Comments, bugs, improvements  Vim wiki

created by
Derek Wyatt
script type
- ctags 5.7 or greater
- PERL (just PERL, you don't need to have Vim compiled with PERL support)
- FSwitch Vim utility (vimscript #2590)

Check out the video demo at: http://www.vimeo.com/4448265

You've got a C++ header file and you've got some prototypes declared in there.  Now you need to create some definitions in a C++ implementation file.  What do you do?  Yank and paste?  Naw :)  Use this plugin instead...

The concept is pretty simple: while in the implementation file, you hit a key and all of the currently undefined function prototypes in the header file are automatically pulled in to the implementation file and inserted at the current cursor position.

- Pure virtual functions are ignored
- Functions that are already defined in the header file are ignored
- Free functions are brought in
- Class name is automatically prefixed to member functions
- Constructors and Destructors sort first
- Only the missing items are pulled in so you can use this utility to bring the implementation file up to match the contents of the header file
- However you format the prototype shouldn't really make a difference.  ProtoDef endeavours to reduce all declarations to a canonical form.

ProtoDef can now be found on GitHub: http://github.com/derekwyatt/vim-protodef
install details
- Extract the archive.
- put doc/protodef.txt into ~/.vim/doc
- put plugin/protodef.vim into ~/.vim/plugin
- :helptags ~/.vim/doc
- read protodef.txt and follow what's in the Setup section to understand what to do with the pullproto.pl file.

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
protodef-0.9.5.zip 0.9.5 2010-10-28 7.0 Derek Wyatt Fixed up a regular expression so it matches pointers and references better (pointers and references attached to the name instead of the type, which is hideous).  (Paolo Capriotti)
protodef-0.9.4.zip 0.9.4 2010-10-13 7.0 Derek Wyatt - Made sure that we need at least 7.0 (Timon Kelter)
- Introduced the disable_protodef_sorting variable.
- Added a fix to deal with default parameters that were class
  instances (e.g. MyClass()) (Matt Spear)
- Fixed function prototype parsing in pullproto.pl such that regex
  special characters are deal with nicely (Matt Spear)
- Handle template specializations properly (Matt Spear)
- Ensure that implementations in the header file but outside the class
  definition are not brought in to the implementation (Dmitry Bashkatov)
protodef-0.9.3.tar.gz 0.9.3 2009-09-14 7.0 Derek Wyatt Fixed a bug in the autocmd where the ".C" extension was written as ",C"
protodef_0.9.2.tar.gz 0.9.2 2009-08-23 7.0 Derek Wyatt Added the ability to ignore the namespace (e.g. if you define a namespace block and don't need the prototypes to be prefixed with the namespace).
protodef_0.9.1.tar.gz 0.9.1 2009-05-05 7.0 Derek Wyatt Fixed issue with nested classes.
protodef_0.9.0.tar.gz 0.9.0 2009-05-02 7.2 Derek Wyatt Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo