Monday, March 31, 2008

join lines in Eclipse 3.3

Many times a day when formatting/re-factoring code I join the next line of code to the end of current line. If it is java code, you can do ctrl-delete twice then insert a white space in between two lines. If it is xhtml file, two ctrl-delete will remove the opening tag of next line (at least in JBoss Tools editor), so a lot of times I just type delete key as fast as I can, Yuk. I cannot tell how much I miss 'J' in vi to join lines.

NOW in Eclipse 3.3, a new (new to me) shortcut ctrl-alt-j will do exactly what 'J' does in vi, joining two lines and put a white space in between. Command-alt-j on mac.

Try it and you will like it.

No comments: