在Notepad++中隐藏注释

9

我有一个包含许多注释的HTML文件。它们很有用,但是当我在处理文件时,我想隐藏它们以使阅读更容易。

你是否遇到过可以做到这一点的插件?除了Notepad++之外,还有其他编辑器吗?


Notepad++可以折叠多行注释。我猜这取决于你所使用的编程语言。 - BoltClock
在渲染HTML之前,使用专门的工具(取决于您的开发平台)删除所有注释是一个好习惯。然后您可以在浏览器中阅读它而不会有任何注释,并且加载速度会更快。 - vitaly-t
4个回答

3

我曾经遇到过同样的问题。你可以将注释行放在大括号之间,例如:

{  //Hidden comments

//Word.Document doc = wordApp.Documents.Open(ref outputFile, ref nullobj, ref nullobj,     
//                                    ref nullobj, ref nullobj, ref nullobj,           
//                                    ref nullobj, ref nullobj, ref nullobj,            
//                                    ref nullobj, ref nullobj, ref nullobj,            
//                                    ref nullobj, ref nullobj, ref nullobj,ref nullobj);
}

所以您可以将其折叠并以此方式查看:
{  //Hidden comments

2
在Notepad++中,从语言菜单中选择HTML。如果您有像这样的注释:
<!-- here are some html comments
  sdfasdfadsf
  asdfasdf
-->

您可以很好地折叠它们。您可以使用“全部折叠”来折叠整个HTML内容,然后从那里开始展开(仅展开您想看到的部分)。


1

解决方法

使用alt+h来隐藏行。

修复方法

以下介绍了如何在现有语言文件中使用NPP设置内联和多行注释的代码折叠/注释折叠。

**警告:点击右上角的X将关闭文档,请在第4步中点击Undock以关闭UDF对话框,而不是X。您可以在文件下拉菜单中恢复关闭的文档。

**警告:您可能需要重新启动NPP才能在语言下拉菜单中看到UDF;所以,请不要感到懊恼。

**警告:在第4步中:我需要清除OpenClose文本字段,然后重新添加数据,这样才能使其工作。

  1. 在下拉菜单中点击语言->定义您的语言...

An arrow points to the "import" button.

点击导入...,如图所示。

A partial URI is shown; an arrow and question mark indicate that PHP has not been contributed; the Javascript UDF file is indicated by a second arrow; "activate the okay button" is indicated by a third arrow.

浏览到用户自定义语言文件(docs.notepad-plus-plus.org)并找到您的UDF;如上图所示,PHP尚未被贡献;但是,JavaScript已经被贡献,而且比内置的JavaScript语言文件要好得多(我建议尝试一下,因此单击确定)。

A drop-down select is indicated with a first arrow containing the UDF name; a second arrow points to a checked checkbox that reads "Allow folding of comments"; a third arrow points to the "open" field in in the "comment line" pane; a fourth pair of arrows points to the "open" and "close" fields in the "comment style" pane.; a fifth arrow indicates activating the "undock" button.

  1. 在“注释和编号”选项卡下,确保在“用户语言”下拉菜单中选择了导入的语言。同时,确保勾选了“允许折叠注释”。单行和内联注释放在“注释行样式”下,多行注释放在“注释样式”下;这样,如果您做多个单行注释,它们将被折叠。

用法

alt + h 可以通过减少行深度来减少水平滚动条。alt + h 可以最大化编辑器缩放 FOV。

代码折叠可以提高编辑器缩放 FOV。

非隐藏注释是不相关的项目;隐藏注释是代码解释。


0

记事本++ 5.9 快捷键
由molave上传,于1/26/2012由francismuir更新 平台:Windows/英语 pdf PDF printer_friendly 打印 minimize 隐藏所有 maximize 显示所有

Table of Contents:
  • 基本文件管理
  • 编辑
  • 搜索
  • 查看

请参见this..


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接