Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
March 9, 2007
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!
3/9/07 11:15 AM
Thanks Rob! I didn't know about that feature. Tips like this are great.
3/9/07 11:16 AM
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 :)
3/9/07 11:26 AM
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.
3/11/07 2:33 PM
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!
3/11/07 2:34 PM
oops: second line was meant to be: - ctrl + alt + [fix] down [/fix] to copy the code below current position
3/16/07 4:45 PM
This is very handy tip .
Thanks, Rob
5/1/07 2:48 PM
Can't you also highlight, click and drag the block somewhere else? Or is that a given that everyone knew that?
5/2/07 1:59 AM
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.