Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Are there any plugins / snippets that can generate a C++ class skeleton from a given header file, for Vim? (I tried ccimpl but there does not seem to be much information on implementing it).

share|improve this question

2 Answers 2

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

or

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

May give you what you're looking for. Failing that, you could simply define your own templates for simple c++ classes (and other structures) by creating either a cpp.tpl or cpp.patterns.tpl file, and then placing them in your after folder and auto running them when a cpp file is loaded.

share|improve this answer
    
As I understand OP's question, he wants to automatically generate empty function definitions from the (member) functions declared in a header file. I'm not sure the template solution you're describing will answer the question. May be you can add more details on the subject. –  Luc Hermitte Aug 5 at 8:44

There is

  • Protodef that'll parse the complete file (malgca gave the link to vim.sf where to find it),
  • lh-cpp, but this time, you'll have to select each function and type :GOTOIMPL as many times as required (:MOVETOIMPL can move a inlined function definition from the header file to the .cpp file). Notes: This also permits to jump to the function definition, and alas, I don't support template functions and classes yet (but is it really an issue as their definitions shall be included?).
  • header-expander, which isn't wrapped into a vim plugin yet. It should give better results as it's based on clang and not on a handmade decoding of a C++ function signature in a scripting language (viml, python, ...) -- here is an article that describes how it works (in French).
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.