On Thu, Jul 10, 2003 at 07:29:10PM -0700, Steve Lamb wrote:
> On 11 Jul 2003 12:23:21 +1000
> Richard Heycock <[EMAIL PROTECTED]> 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!
> 
>     And you're wrong, that isn't the easiest way.  Assuming that all the text
> is the entire file:
> 
> %s/\(.*\)/text\1/g

Ungh! (to coin a word)

:%s/^/text/

is all you need.

>     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.

You sure like to do things the hard way!

Lower case 'm' sets a mark so type 'ma' at one end of the range and 'mb'
at the other end and then (the single quote goes to a mark):

:'a,'bs/^/text/

Works in vi and vim.

-- 
"Put your talent into your work, but your genius into your life."
                -- Oscar Wilde
    Rick Pasotto    [EMAIL PROTECTED]    http://www.niof.net


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to