block moves in vi

Mitchell Wyle wyle at solaris.UUCP
Wed Jul 6 21:37:37 AEST 1988


In article <803 at taux01.UUCP> cjosta at taux01.UUCP (Jon Sweedler) writes:
>Is there any way to move a block of text in vi?  When I say block, I
>mean a rectangle of text.  For example:
>
>what EVER is in
>upper CASe in this
>senteNCE is part
>of a BLOCk of text
>and wHATEver is in
>lower CASe is not
>part OF The block.
>
>So the block starts in column 6 and continues to column 9.  I would
>like to be able to pick up the block and insert or overlay it in
>another position.  Thanks in advance.

Try:

:map ;x 5l"By5l0j

Then try typing ;x 7 times.  The buffer b should contain your
upper case text.  (To put it somewhere, type "bp)

I don't know if that's what you want.  I often have similar tasks, do
them manually a few times while watching my key-strokes, then write a
quick :map macro to automate them.  For those of us who don't think in
mock-lisp ;-) , I suspect my strategy is good for quick editor macros.

The best resource on vi(1) is Dan Smith at Island Graphics.  He
probably has a better, more elegant vi macro to accomplish your task
which he uses all the time.  Right Dan?
-- 
-Mitchell F. Wyle            wyle at ethz.uucp
Institut fuer Informatik     wyle%ifi.ethz.ch at relay.cs.net
ETH Zentrum                  
8092 Zuerich, Switzerland    +41 1 256-5237



More information about the Comp.unix.questions mailing list