Wednesday, December 4, 2013

Re: How would a vim guru type this c++ snippet?

On Wed, Dec 4, 2013 at 9:30 AM, <hermitte@free.fr> wrote:
> Actually, OP's question is about smart generation of C++ functions (constructors, and assignment operator) given the class attributes. It's not about renaming refactorings.


Thank you for your help! I will take a look at lh-vim.

Without internet access on a new install of vim, how would a vim guru
would convert this:

float mTemperature;

unsigned char mType;

double mDistanceFromCenter;

long long int mId;

std::string mName;

Into this:
mTemperature(Other.mTemperature),
mType(Other.mType),
mDistanceFromCenter(Other.mDistanceFromCenter),
mId(Other.mId),
mName(Other.mName),

I suspect, the guru would do one of:

1. copy the parameters into a blank text document. Strip the variable
types, semicolon, and whitespace. Past the results into a spreadsheet
program. Use a formula '=A1 & "(Other." & A1 & "),"'. Repeat
formula, copy, paste into vim.

2. A gnarly regular expression

3. Some clever 'q' gymnastics

I tried vimgolf, but for some reason cannot create a twitter account
at the moment, which is a requirement.

Thank you again for your help everyone,

Chris

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: