Wednesday, December 2, 2009

Re: Repeat entry into insert mode?

Chris Suter <cgs1019@gmail.com> [09-12-02 19:56]:
> Say I've entered insert mode by typing 4s -- removing four characters from
> the current cursor position and leaving me in insert mode. Is there a
> built-in means of repeating this?
>
> Use case:
> I have one line of text like:
>
> private EntryReader xmlEntryReader;
>
> I want to add 3 new entries with the result:
>
> private EntryReader xmlEntryReader;
> private EntryReader nativeEntryReader;
> private EntryReader binaryEntryReader;
> private EntryReader jsonEntryReader;
>
> My instinct is to do a yyppp on the first line (xmlEntryParser) giving me
>
> private EntryReader xmlEntryReader;
> private EntryReader xmlEntryReader;
> private EntryReader xmlEntryReader;
> private EntryReader xmlEntryReader;
>
> then use search (/xml<CR>) and n to position my cursor sequentially on the
> beginnings of the words I want to change, doing each edit along the way. So
> I would type (with the cursor on the first xmlEntryReader)
>
> n3snative<ESC>n3sbinary<ESC>n3sjson<ESC>
>
> What I'm looking for is a way to avoid typing "3s" each time. Is the
> previous entry-into-insert method stored anywhere? Maybe the previous normal
> command? I know I can repeat edits with . and I use this constantly (I
> actually have "n." stored in the @n register by default so that i can repeat
> find-next/repeat-edit by macro which I highly recommend!). I'm looking for
> basically the same thing but without the actual editing being repeated (nor,
> of course, the exit from insert mode)
>
> Any thoughts would be greatly appreciated! This comes up for me surprisingly
> often...
> --
> Christopher Suter
> www.grooveshark.com
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php

Whats about this

First mark the the "xml"s with a visual block and delete them,
then enter insert mode and add "native","binary","json" using
cursor keys and character key. You only have to enter/leave
insert mode once.

Or did I understand wrongly here ?

HTH
Best regards,
mcc


--
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: