Vim C ++ generates source file based on header file

I do a lot of C ++ programming in vim, and I was wondering if there are any plugins or snippets out there that can generate the source file depending on the contents of the header file.

IE: test.h

class test { public: test(); }; 

and then going to the test.cpp file and typing "src" and expanding it (using some kind of snippet plugin like UltiSnips), it will look in the test.h file for funcions and (in this case) do:

 test::test() { //code } 

I got this idea from Derek Wyatt's blog and he does it with XPTemplate, so I thought it would be great to do the same in UltiSnips.

+7
c ++ vim code-snippets
source share
2 answers

lh-cpp offers the GOTOIMPL function, which analyzes the prototype of this function and either proceeds to the corresponding definition or generates its-fly. [NB: he knows what to do with virtual, static, namespace / embedded classes, return type, modifiers, etc. (Except templates)]

Regarding how to parse the header file and generate all the related functions, the same question was asked on the vim mailing list 2-3 weeks ago, where is the other solution (the protodef you read about).

+1
source share

All Articles