Intellij tip - Joining multiple lines into one

There are times when you have some code with each statement on its own line, and you want to move it all onto one line.

CSS is where I've needed this the most.

You start off with some code like this:
.box {
background-color: lightblue;
padding: 11px 10px 11px 38px;
margin: 0 0 0 0;
text-decoration: none;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
view raw gistfile1.css hosted with ❤ by GitHub
And really want this:
.box { background-color: lightblue; padding: 11px 10px 11px 38px; margin: 0 0 0 0; text-decoration: none; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
view raw gistfile1.css hosted with ❤ by GitHub
Intellij has a very simple way to do this by using Ctrl-Shift-J - for more information, see http://www.jetbrains.com/idea/webhelp/joining-lines-and-literals.html

Popular posts from this blog

AspectJWeaver with JDK 7 - error - only supported at Java 5 compliance level or above

JUnit parameterized test with Spring autowiring AND transactions