简体   繁体   English

Notepad++ 文件样式

[英]Notepad++ File Styling

I'd like to copy my PHP language styling to a new file type and have it applied to specific file, even when there is no <?我想将我的 PHP 语言样式复制到新的文件类型并将其应用于特定文件,即使没有<? tags in the page.页面中的标签。

I view log files on a daily basis.我每天查看日志文件。 Today while viewing a file I inadvertently added <?今天在查看文件时我无意中添加了<? to the start of the file.到文件的开头。 The log was then formatted as PHP and became much easier to read.日志随后被格式化为 PHP 并且变得更容易阅读。

Is it possible to copy the PHP styling to a new Language Type (logFile) and have the styling applied to specific files even if the file doesn't contain <?是否可以将 PHP 样式复制到新的语言类型 (logFile) 并将样式应用于特定文件,即使文件不包含<? ? ?

Thanks谢谢

If you want to create a new style based on PHP style please refer to this SO question.如果您想基于 PHP 样式创建新样式,请参阅SO 问题。

But if you want a quicker and easier (in my opinion) solution I propose you this alternative: instead of creating a new language style based on PHP you can associate one or more new file extension(s) to the existing PHP style.但是,如果您想要一个更快更简单(在我看来)的解决方案,我建议您使用这种替代方法:您可以将一个或多个新文件扩展名与现有 PHP 样式相关联,而不是创建基于 PHP 的新语言样式。

To do this use the menu " Settings "/" Style configurator... " and specify your extension(s) in the " User ext. " textbox:为此,请使用菜单“设置”/“样式配置器... ”并在用户扩展名”文本框中指定您的扩展名:

在此处输入图片说明

If you want to add more than one extension just use a space as separator: "ext1 ext2".如果要添加多个扩展名,只需使用空格作为分隔符:“ext1 ext2”。

Click "Save & Close" button.单击“保存并关闭”按钮。

Now if you open a file that has one of the new extension(s), Notepad++ should style it using PHP rules even if there are no <?现在,如果您打开一个具有新扩展名之一的文件,即使没有<? tags in the file.文件中的标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM