在 Eclipse 中注释 .txt 文件中的文本的快捷方式是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22392814/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:35:01  来源:igfitidea点击:

What is shortcut for commenting text in .txt files in Eclipse?

eclipsecomments

提问by Kirill Zhukov

I know that there is shortcut in Eclipse Command+/ (CTRL+/) to comment line or block but not for .txt file. So how to do that instead of commenting each line manually?

我知道 Eclipse Command+/ (CTRL+/) 中有快捷方式来注释行或块,但不适用于 .txt 文件。那么如何做到这一点而不是手动注释每一行呢?

回答by Chandrayya G K

As @Bob Kuhar commented you can open the .txt file in Java editor. Right click on the text file, go to Open with > Other. Choose Java Editorin the editor selection dialog box.

正如@Bob Kuhar 所评论的,您可以在 Java 编辑器中打开 .txt 文件。右键单击文本文件,转到打开方式 > 其他。 在编辑器选择对话框中选择Java Editor

Select a single line or block of lines then press

选择一行或一行,然后按

  • Ctrl+ /--> All line will be commented in //style comments(Single line comments)

  • Ctrl+ Shift+ /--> All line will be commented in /*style(Multi line comment)

  • Ctrl+ /--> 所有行都将在//样式注释中进行注释(单行注释)

  • Ctrl+ Shift+ /--> 所有行将以/*样式进行注释(多行注释)

Note that if you type Jay keyword like class, for, while etc then these will be highlighted in coloured text.

请注意,如果您输入 Jay 关键字,如 class、for、while 等,则这些关键字将以彩色文本突出显示。