如何在记事本中添加用户定义的折叠区域++?
我不知道如何配置 Notepad++ 以显示用户定义的关键字的区域。
我有一个很大的跟踪文件,它显示了过程的开始和结束。该文件看起来像这样:
Beginn abc.def;
...
Beginn ghi.jkl;
...
Ende ghi.jkl;
...
Ende abc.def;
我想像这样折叠这些区域:
[+] Beginn abc.def;
或者
[-] Beginn abc.def;
...
[+] Beginn ghi.jkl;
...
Ende abc.def;
是否可以配置 Notepad++ 以显示这样的折叠?
I can't figure out how to configure Notepad++ to display regions for user defined keywords.
I have a big trace file which shows the start and the end of a procedure. The file looks like this:
Beginn abc.def;
...
Beginn ghi.jkl;
...
Ende ghi.jkl;
...
Ende abc.def;
I would like to fold those regions like this:
[+] Beginn abc.def;
or
[-] Beginn abc.def;
...
[+] Beginn ghi.jkl;
...
Ende abc.def;
Is it possible to configure Notepad++ to display folding like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
对于 6.5.5 及更高版本:
在“语言”菜单下,有一个名为“定义您的语言...”的菜单项
在“文件夹和默认”选项卡中,有一个名为“代码折叠”的组,您可以在其中输入“打开”和“关闭”关键字。
对于 6.5.5 之前的版本:
在“查看”菜单下有一个名为“用户定义的对话框...”的菜单项。 "
在“文件夹和默认”选项卡中,您可以输入“文件夹打开关键字” ”和“文件夹关闭关键字”
For version 6.5.5 and above:
Under the menu "Language" there is a menuitem called "Define your language..."
In the tab "Folder & Default" is a group called "Folding in code" where you can enter an "Open"- and a "Close"-Keyword.
For versions older than 6.5.5:
Under the menu "View" there is a menuitem called "User-Defined Dialog..."
In the tab "Folder & Default" you can enter a "Folder Open Keyword" and a "Folder Close Keyword"
另一种简单的方法是添加“注释命令”,然后添加“ { ”以开始,然后添加“注释命令”,然后添加“ } ”。在 C/C++、Java、Javascript 等中,它就像这样:
Another simple way is just add "comment command" and then " { " to begin and later "comment command" and then " } ". In C/C++, Java, Javascript, etc. it would be just like this :
我有类似的问题。我想添加像 #region / #endregion 这样的自定义标签,以在不支持它的语言中创建任意折叠点。具体来说,我正在尝试为 php 执行此操作。
研究了一两个小时后,由于底层的 scintilla 词法分析器,修改现有语言似乎相当困难,编写插件可能是完成此任务的唯一方法。
然而,我确实发现了一个不错的解决方法:
将您想要折叠的代码包装在注释中,例如:
然后将光标移到左大括号之前,然后按 CTRL+ALT+ b 突出显示整个块,然后按 ALT+h 将其隐藏。
这是与折叠不同的操作,但它可以在紧要关头发挥作用。
I have a similar problem. I want to add a custom tag like #region / #endregion to create arbitrary folding points in languages that don't support it. Specifically, I am trying to do this for php.
After researching for an hour or two, it seems that modifying an existing language is quite difficult due to the underlying scintilla lexer, and writing a plugin may be the only way to accomplish this.
I did discover however a decent workaround:
Wrap the code you wish to fold in comments like:
Then move your cursor before the open brace and press CTRL+ALT+b to highlight the entire block, followed by ALT+h to hide it.
It's a different operation than folding, but it works in a pinch.
我使用 Marcelo 的答案为自己解决了这个问题(在 Perl 中),做了一个更改......
如果我在注释符号和括号之间包含一个空格,那么它就不起作用。它必须立即放置在:
请注意,如果我这样做:
在文本后面加上括号,它也不起作用
I used Marcelo's answer to solve this for myself (in Perl), with one change...
If I included a space between the comment symbol and the bracket then it wouldn't work. It had to be placed immediately after:
Note that if I do:
with the bracket after the text it won't work either
!!免责声明:PHP 完全菜鸟!
假设您将 PHP 封装在某些 HTML 中,则可以使用
?> 定义自定义部分。
例如:
Notepad++ 将允许您任意折叠这些部分,并且您可以用“#”标记这些部分。
刚刚学习 PHP,所以我的代码可能不太好;这仍然是一个持续的过程。
!! Disclaimer: Total noob at PHP !!
Assuming that you are wrapping your PHP in some HTML, you can define custom sections using
<?php and
?>.Ex:
Notepad++ will then allow you to collapse the sections arbitrarily and you can label the sections with "#".
Just learning PHP, so my code might not be awesome; It's still an ongoing process.
如果是 SQL,那么用 BEGIN 和 END 封装代码效果很好。将显示 BEGIN 语句以及您在同一行添加的任何注释。
例如:
If it's SQL, then encapsulating your code with BEGIN and END works well. The BEGIN statement is shown, plus any comments you add on the same line.
e.g:
第一步:添加具有打开和关闭功能的唯一键(即,
使用缩进和/或注释来指示嵌套级别。
步骤 2:完成后,
{CTRL}-H
替换所有“{{{”和“}}}”。第 3 步:评论条(应用程序)。
STEP ONE: Add a unique key with open and close (i.e.,
Use indentation and/or comments to indicate nest-level.
Step 2:
{CTRL}-H
when you're finished. Replace all '{{{' and '}}}'.STEP 3: Comment strip (app).