Topic: Move Line(s) (1 of 6), Read 18 times
Conf: VEDIT Macro Language Support
From: Michael Prather
Date: Saturday, June 12, 2004 05:56 AM

Is there a couple commands or macros that allow you to move the current line up & down? or the current block of lines up & down?

 


Topic: Re: Move Line(s) (2 of 6), Read 17 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Sunday, June 13, 2004 05:45 AM

Michael,

your question

>Is there a couple commands or macros that allow you to move the current
>line up & down? or the current block of lines up & down?

is not exactly clear to me. So here are two possible answers:

1) In case you mean it interactively:

You can use the menu command {Block, Move to cursor}.
First highlight the desired source line(s) as block,
then goto to the target position and use the above command.


2) If you would like to write a macro to do it:

Use the command:
Block_Copy(Block_Begin, Block_End, DELETE)

or perhaps a sequence like this:

Goto_Line(5) // goto first source line
Reg_Copy(103, 2, DELETE) // copy 2 lines into temporary text-
// register and delete the lines
Goto_Line(3) // goto target position
Reg_Ins(103) // insert copied lines here
Reg_Empty(103) // empty temporary text register


Christian

 


Topic: Re: Move Line(s) (3 of 6), Read 17 times
Conf: VEDIT Macro Language Support
From: Rich Hureau
Date: Tuesday, June 15, 2004 08:33 AM

To move the current line up/down, I have the following code assigned to keys in Vedit.key:

to move the line up:
[VISUAL EXIT]BOL DL L(-1) UD L(-1)

to move the line down:
[VISUAL EXIT]BOL DL L UD L(-1)

 


Topic: Re: Move Line(s) (4 of 6), Read 21 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, June 15, 2004 12:19 PM

At 08:33 AM 6/15/2004, you wrote:
>From: "Rich Hureau"
>
>To move the current line up/down, I have the following code assigned to keys in Vedit.key:
>
>to move the line up:
>[VISUAL EXIT]BOL DL L(-1) UD L(-1)
>
>to move the line down:
>[VISUAL EXIT]BOL DL L UD L(-1)

Richard:

Those are interesting (!) macros since they delete the line and then use the Undo_Delete() function to restore it in another position.

As was recently suggested here, please use full macro command names instead of abbreviations; this will help users that are less familiar with VEDIT.

The long form of the first macro is:

[VISUAL EXIT]Begin_Of_Line() Del_Line() Line(-1) Undo_Delete() Line(-1)

Thank you for posting these macros.

Ted.


Ted.
-------------------------------------------------------------------------
Ted Green (ted@...) Greenview Data, Inc.
Web: www.... PO Box 1586, Ann Arbor, MI 48106
Tel: (734) 996-1300 Fax: (734) 996-1308 VEDIT - Text/Data/Binary Editor
-------------------------------------------------------------------------
www.SpamStopsHere.com - Ranked #1 accuracy by Network Computing Magazine.

 


Topic: Re: Move Line(s) (5 of 6), Read 22 times
Conf: VEDIT Macro Language Support
From: Rich Hureau
Date: Wednesday, June 16, 2004 07:51 AM

On 6/15/2004 12:19:30 PM, Ted Green wrote:
>As was recently suggested
>here, please use full macro
>command names instead of
>abbreviations; this will help
>users that are less familiar
>with VEDIT.

This is a good suggestion and I will follow it in the future. I think I'm nostalgic for the old macro language that Vedit used to have, and was trying to make the newer language equally unreadable. ;-) Glad you like the macros!

Rich

 


Topic: Re: Move Line(s) (6 of 6), Read 18 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, June 16, 2004 09:41 PM

I added these entries to the key-mac.lib file:

**********
Move current line up / down - #1.
**********

Moves the current line up or down (respectively) in the file.
Uses text register 103 as a temporary register.

[VISUAL EXIT]
Begin_Of_Line() Reg_Copy(103,1,DELETE)
Line(-1,NOERR) Reg_Ins(103) Line(-1)

[VISUAL EXIT]
Begin_Of_Line() Reg_Copy(103,1,DELETE)
Line(1,NOERR) Reg_Ins(103) Line(-1)


**********
Move current line up / down - #2
**********

Moves the current line up or down (respectively) in the file.
Uses only the Undo stack and doesn't change any other resources.

[VISUAL EXIT]
Begin_Of_Line() Del_Line()
Line(-1,NOERR) Undo_Delete() Line(-1)

[VISUAL EXIT]
Begin_Of_Line() Del_Line()
Line(1,NOERR) Undo_Delete() Line(-1)

Ted.