This may already be obvious to heavy Eclipse/CFEclipse/FlexBuilder users, but there's a really simple way to move one or more lines of code around without having to use copy/paste.

To move a single line of code, place the cursor anywhere on the line and click alt-up arrow to move the code up one line, or alt-down arrow to move the code down one line.

To move multiple lines of code at once, highlight the code you wish to move and use the same alt-up arrow/alt-down arrow shortcut. It's that easy!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
alan's Gravatar Thanks Rob! I didn't know about that feature. Tips like this are great.
# Posted By alan | 3/9/07 11:15 AM
Jim Priest's Gravatar I recently added this to the CFEclipse wiki:

http://trac.cfeclipse.org/cfeclipse/wiki/ShortcutK...

It's good to review this now and then and learn something new :)
# Posted By Jim Priest | 3/9/07 11:16 AM
Rob Brooks-Bilson's Gravatar Alan - sometimes it takes someone showing me something that's obvious to almost everyone else ;-)

Jim, thanks for the link to the wiki. I skimmed it once, but obviously it never sank in.
# Posted By Rob Brooks-Bilson | 3/9/07 11:26 AM
David Harris's Gravatar You can also copy lines/blocks of code the same way, just hold down the "ctrl" key at the same time.

EG:

highlight line/block of code then:
- ctrl + alt + up arrow to copy the code above current position
- ctrl + alt + up down to copy the code below current position

Eclipse/CFEclipse/FB2 is great!
# Posted By David Harris | 3/11/07 2:33 PM
David Harris's Gravatar oops: second line was meant to be: - ctrl + alt + [fix] down [/fix] to copy the code below current position
# Posted By David Harris | 3/11/07 2:34 PM
Dipak's Gravatar This is very handy tip .
Thanks, Rob
# Posted By Dipak | 3/16/07 4:45 PM
todd sharp's Gravatar Can't you also highlight, click and drag the block somewhere else? Or is that a given that everyone knew that?
# Posted By todd sharp | 5/1/07 2:48 PM
Rob Brooks-Bilson's Gravatar Hi Todd,

Yep, click and drag is supported as well. I just thought it was really cool that you could move one or more lines up or down the way they've implemented it. I find myself needing this sort of functionality more often than I realized.
# Posted By Rob Brooks-Bilson | 5/2/07 1:59 AM



Copyright 1995-2008 Rob Brooks-Bilson. All rights reserved.
Aura skin for Raymond Camden's BlogCFC inspired by Joe Rinehart & Steven Erat. This blog is running version 5.9.004.