Monday, February 1, 2016

Re: How would you repeatedly produce these lines?

etoipm1i0@gmail.com wrote:
> I'm coding in Python and need to produce a number of lines like the following
>
>> p3[0] = {'name': , 'symbol': , 'number': }
>> p3[1] = {'name': , 'symbol': , 'number': }
>> ...
> and I'm wondering the best way to go about this. My main thought is to just copy-paste and maybe fill the brackets with some kind of place-keeper and then try to figure out a way to sequentially replace them with increasing integers. But somehow it seems like there out to be a more elegant Vim solution.
>
> Any thoughts?
>
I'd write the first line:
p3[0] = ...

Yank it (Y) and put it (say I wanted twenty copies: 19p
Then I'd use ctrl-v and highlight all the 0s.
Then I'd use :I

The latter command is supported by visincr
(http://www.drchip.org/astronaut/vim/index.html#VISINCR). It can do
incrementing/decrementing things with binary, octal, hexadecimal, roman
numerals, daynames, monthnames, and dates (ymd, dmy, mdy).

Regards,
Chip Campbell

--
--
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/d/optout.

No comments: