[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vi Qustion



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!

    And you're wrong, that isn't the easiest way.  Assuming that all the text
is the entire file:

%s/\(.*\)/text\1/g

    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.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.
	                       |    -- Lenny Nero - Strange Days
-------------------------------+---------------------------------------------

Attachment: pgp3qEHQXxg3S.pgp
Description: PGP signature


Reply to: