On Mon, Feb 1, 2016 at 11:24 AM, Ben Fritz <[email protected]> wrote:
> On Monday, February 1, 2016 at 9:00:25 AM UTC-6, Charles Campbell wrote: > > [email protected] 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 > > Sometime this year (I think patches 754-823) the g_CTRL-A command was > introduced to create increasing sequences of integers (:help v_g_CTRL-A). > Also CTRL-A/CTRL-X was modified to respect visual mode better. So the > plugin is probably not even required anymore. > > I don't think I'd quite say that. This plugin is capable of much more than just this specific example. Thank you, by the way, I knew that CTRL-A/X had been modified to work in visual mode, but I was not aware of the g_CTRL_A/X variant! That is super useful! Cheers! Ethan Alan > -- > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
