Java Intellij IDEA 上的 System.out.println() 快捷方式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38992114/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
System.out.println() shortcut on Intellij IDEA
提问by m.rossi
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?
我知道我可以System.out.println()
用"sout" + tab
. 有没有办法"Syso" + ctrl + space
像在 eclipse 中那样做?
回答by Konstantin Labun
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.
是的,你可以做到。只需打开设置 -> 实时模板。使用syso
缩写和System.out.println($END$);
模板文本创建新的。
回答by Olga
In Idea 17eap:
在想法 17eap 中:
sout
: Prints
sout
: 印刷
System.out.println();
soutm
: Prints current class and method names to System.out
soutm
: 将当前类和方法名称打印到 System.out
System.out.println("$CLASS_NAME$.$METHOD_NAME$");
soutp
: Prints method parameter names and values to System.out
soutp
: 将方法参数名称和值打印到 System.out
System.out.println($FORMAT$);
soutv
: Prints a value to System.out
soutv
: 打印一个值到 System.out
System.out.println("$EXPR_COPY$ = " + $EXPR$);
回答by Leo
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".
打开设置(默认为 Alt + Ctrl + S)并搜索实时模板。在上部有一个选项,上面写着“默认使用 TAB 扩展”(TAB 是默认值),选择“自定义”,然后点击“更改”并将键映射“ctrl+空格键”添加到选项“扩展实时模板/埃米特的缩写”。
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.
现在您可以按 ctrl + 空格键并展开实时模板。现在,要将其更改为“syso”而不是“sout”,在“实时模板”选项中,选中了大量选项列表,转到“其他”并展开它,您会在那里找到“sout”,只需将其重命名即可到“syso”并点击应用。
Hope this can help you.
希望这可以帮到你。
回答by Vyas Ramankulangara
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".
如果您想知道 intellij 中的所有快捷方式,请点击“Ctrl + J”。这将显示所有快捷方式。对于 System.out.println() 键入“sout”并按“Tab”。
回答by MrKulli
On MAC you can do sout + return
or ?+j
(cmd+j) opens live template suggestions, enter sout
to choose System.out.println();
在 MAC 上,您可以执行sout + return
或?+j
(cmd+j) 打开实时模板建议,输入sout
以选择System.out.println();