Move / Copy Lines Macro

Move / Copy Lines Macro

3
NewbieNewbie
3

    Mar 12, 2005#1

    One thing I really like about Eclipse is some of the keyboard shortcuts it has by default. One of which is the move/copy lines shortcut ability. In Eclipse you can hold the Alt key and press the up or down arrows and it will move the current line up or down. You can also use Ctrl+Alt+Arrow key to copy the current line. Both of these can be used while selecting multiple lines to accomplish the same thing but with a group of lines. Does anyone know how to setup UE to do this?

    206
    MasterMaster
    206

      Mar 12, 2005#2

      I use these all the time, assigned to keystrokes.



      Current Line Up:

      Key HOME
      StartSelect
      Key END
      Cut
      Key DEL
      Key UP ARROW
      "
      "
      Key UP ARROW
      Paste
      Key HOME


      Current Line Down:

      Key HOME
      StartSelect
      Key END
      Cut
      Key DEL
      Key DOWN ARROW
      "
      "
      Key UP ARROW
      Paste
      Key HOME


      Copy Current Line:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Key HOME
      StartSelect
      Key END
      Copy
      EndSelect
      Key HOME


      Duplicate Current Line:

      Key HOME
      StartSelect
      Key END
      Copy
      EndSelect
      Key END
      "
      "
      Paste
      Key HOME
      Software For Metalworking
      http://closetolerancesoftware.com

      63
      Advanced UserAdvanced User
      63

        Mar 13, 2005#3

        Hi mrainey56

        Thanks for sharing!

        3
        NewbieNewbie
        3

          Mar 13, 2005#4

          mrainey56,

          Thanks for your reply. What you offered was along the along lines of what I was looking for, but not exactly. A couple issues I notice:

          1) When I use the HOME key the cursor goes to the beginning of the text (after any indentation). This is desired behavior for the most part (I believe there is a pref that allows this behavior to be changed). When this happens and the following line had indentation the following line loses it proper spacing.

          2) When the line that was cut/copied is pasted one line up (using the up macros) it is pasted at the beginning of the line, I think an extra new line is needed.

          3) It would be nice if it didn't overwrite what was in your clipboard (I guess it could be modified to use an alternate clipboard).

          4) Would be nice if this supported multiple line selections, not sure if this is possible.

          Sorry to sound like I'm criticizing, just wanted to see if anyone have suggestions for my needs. :)

          206
          MasterMaster
          206

            Mar 13, 2005#5

            meltdown,

            You're correct that different UE configurations could affect how these macros function. They've worked perfectly for me for several years now, with my configuration and my way of doing things. They might not give you what you need.

            At the least, they might give you some ideas for creating your own macros.


            Mike
            Software For Metalworking
            http://closetolerancesoftware.com

            46
            Basic UserBasic User
            46

              Mar 14, 2005#6

              Hi meltdown,

              There is some responses to your issues:

              1) -> Add a second Key HOME to ever go at the beginning of a line

              2) -> Try this code to select/cut the line:

              Code: Select all

              Key HOME
              Key HOME
              StartSelect
              Key DOWN ARROW
              Cut
              3) -> Add a Clipboard 9 at the beginning of the macro and a
              Clipboard 0 at the end (9 is which I personally use, you can choose
              yours)

              4) -> Put the Select/cut part in the Else section of an IfSel test.

              If you need an example, this is what the Current Line Up macro
              should like:

              Code: Select all

              Clipboard 9
              IfSel
              Cut
              Else
              Key HOME
              Key HOME
              StartSelect
              Key DOWN ARROW
              Cut
              EndIf
              Key UP ARROW
              Paste
              Key HOME
              Clipboard 0
              Two remarks:

              a) The selection doesn't works on the last line of the file :(
              b) I'm not responsible for the result in case of the selection
              doesn't start and/or doesn't stop at the beginning of a line. ;)

              HTH (Hope This Help)
              Alain
              Never forget: "Above the clouds, The sky is blue and the sun shine"

              3
              NewbieNewbie
              3

                Mar 14, 2005#7

                Thanks, I'll try playing with them at work today. :)