Re: vi Qustion
On Fri, 2003-07-11 at 12:29, Steve Lamb wrote:
> On 11 Jul 2003 12:23:21 +1000
> Richard Heycock <rgh@roughage.com.au> wrote:
> > The easiest way to do this is to type:
> > A [insert at the beginning of the line]
> > <text><ESC>
> > j [moves down one line]
> > . [re-does the last command]
> >
> > This will work in both vi and vim.
>
> Ungh. You're the second person to advocate the stupid home keys. That
> isn't easy. Point me to a keyboard made in the last 20 years without them.
> Hell, even my *PALM* keyboard has them!
Where in the above text do I mention home keys?
The only problem with the above solution is that the 'A' should be an
'I' :(
>
> And you're wrong, that isn't the easiest way. Assuming that all the text
> is the entire file:
>
> %s/\(.*\)/text\1/g
or :%s/^/text/
but if you only have 2 or 3 lines to change why bother?
rgh
>
> If it isn't change the % to the appropriate range markers (which in vi I
> am unfamiliar with). In vim that would be V to start marking the entire lines
> then just highlight the lines, then :s/\(.*\)/test\1/g. vim will insert the
> appropriate markers for the marked text ({,} iirc) for the range for s to use.
--
"It is possible to make things of great complexity out of things
that are very simple. There is no conservation of simplicity"
-- Stephen Wolfram
Richard Heycock <rgh@roughage.com.au>
tel : 0410 646 369
key fingerprint : 909D CBFA C669 AC2F A937 AFA4 661B 9D21 EAAB 4291
Reply to: