sponsor Vim development Vim logo Vim Book Ad

C++ code template generator : Generate C++ code templates based on the header file

 script karma  Rating 6/8, Downloaded by 1935  Comments, bugs, improvements  Vim wiki

created by
Michael Brailsford
script type
Opens a template file and replaces various tags with values that are parsed from the header file.  The information parsed includes data members and their types, constructors including overloaded constructors and their parameters, methods declarations and their return types and parameter lists, as well as the class name.  This is then put into the source template in the proper format.  Data members are added to the constructors to relieve typing to initialize all your class variables.  The destructor is also added.  There is a little documentation in the ftpplugin/cpp/tmpl_gen.vim file.  It describes what tags that are currently supported so you can customize the template file that is included.  Feedback is needed, and very welcome.  Feel free to email me with any bug reports, feature requests, or if you need help getting it set up.

NOTE!   This is currently broken.  I will fix it after the semester ends, but for the time being you can edit tmpl_gen.vim and change 'require "tmpl_gen.rb"' to 'require "#{ENV['HOME']}/.vim/ftplugin/cpp/tmpl_gen.rb".

I would fix this now, but I am in the middle of making some major modifications, and I have finals coming up.
install details
Untar the tmpl_gen.tar.gz file in your ~/.vim directory and then edit your .vimrc and add the following autocommand:
au bufnewfile *.cpp call Make_cpp_template()


rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tmpl_gen.tar.gz 0.25 2002-11-24 6.0 Michael Brailsford 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.