System.out.println() shortcut on Intellij IDEA

JavaIntellij Idea

Java Problem Overview


I know I can print System.out.println() with "sout" + tab. Is there a way I can do it with "Syso" + ctrl + space like in eclipse?

Java Solutions


Solution 1 - Java

In Idea 17eap:

sout: Prints

System.out.println();

soutm: Prints current class and method names to System.out

System.out.println("$CLASS_NAME$.$METHOD_NAME$");

soutp: Prints method parameter names and values to System.out

System.out.println($FORMAT$);

soutv: Prints a value to System.out

System.out.println("$EXPR_COPY$ = " + $EXPR$);

Solution 2 - Java

Yeah, you can do it. Just open Settings -> Live Templates. Create new one with syso as abbreviation and System.out.println($END$); as Template text.

Solution 3 - Java

If you want to know all the shortcut in intellij hit Ctrl + J. This shows all the shortcuts. For System.out.println() type sout and press Tab.

Solution 4 - Java

Open up Settings (By default is Alt + Ctrl + S) and search for Live Templates. In the upper part there's an option that says "By default expand with TAB" (TAB is the default), choose "Custom" and then hit "change" and add the keymap "ctrl+spacebar" to the option "Expand Live Template/Emmet Abbreviation".

Now you can hit ctrl + spacebar and expand the live templates. Now, to change it to "syso" instead of "sout", in the Live Templates option, theres a list of tons of options checked, go to "other" and expand it, there you wil find "sout", just rename it to "syso" and hit aply.

Hope this can help you.

Solution 5 - Java

On MAC you can do sout + return or āŒ˜+j (cmd+j) opens live template suggestions, enter sout to choose System.out.println();

Solution 6 - Java

Type sout and press Tab, it will generate System.out.println();

Type sou and press Tab, It will generate System.out.printf("");

Solution 7 - Java

If using scala, try priv + tab

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionm.rossiView Question on Stackoverflow
Solution 1 - JavaOlgaView Answer on Stackoverflow
Solution 2 - JavaKonstantin LabunView Answer on Stackoverflow
Solution 3 - JavaVyas RamankulangaraView Answer on Stackoverflow
Solution 4 - JavaLeoView Answer on Stackoverflow
Solution 5 - JavaMrKulliView Answer on Stackoverflow
Solution 6 - JavaSupun SandaruwanView Answer on Stackoverflow
Solution 7 - JavaJanac MeenaView Answer on Stackoverflow