本页内容

下载语法高亮定义

Qt Creator 使用KSyntaxHighlighting语法高亮引擎,并采用 Kate 语法定义。它自带了大多数常用的 Kate 定义,您还可以下载更多定义。有关定义文件的更多信息,请参阅《使用语法高亮》

语法定义文件中显式指定的字体属性(如粗体、斜体、下划线或删除线)将被应用。如果颜色在Qt Creator 主题下仍可读,则会应用相应颜色。

记住首选定义

如果您打开的文件有多个可用的语法高亮定义,编辑器会提示您选择要使用的定义。

要保存该选择,请选择“Remember My Choice ”。

要重置已保存的定义,请转到“Preferences ” > “Text Editor ” > “Generic Highlighter ”,然后选择“Reset Remembered Definitions ”。

“文本编辑器”偏好设置中的“通用高亮”选项卡

下载定义

如果编辑器无法为打开进行编辑的文件找到高亮定义,系统会提示您下载额外的高亮定义文件。选择“Download Definitions ”以下载这些文件。

要查看已下载文件的相关信息,请打开“通用消息”视图。

忽略文件模式

若要屏蔽针对特定文件模式的提示,请转至“Preferences ” > “Text Editor ” > “Generic Highlighter ”,并将该模式以逗号分隔的形式添加到“Ignored file patterns ”中。

若要根据文件扩展名忽略文件,请添加:\A(?:(?s:[^/\\]*\.<extension>))\z

若要根据文件名忽略文件,请添加:\A(?:(?s:<string>[^/\\]*))\z

例如:\A(?:[^/\\]*\.txt)\z,\A(?:LICENSE[^/\\]*)\z,\A(?:README)\z,\A(?:qmldir)\z

添加自定义定义

如果您编写了自定义语法定义文件,请在User Highlight Definition Files 中添加一个定义搜索路径。

要应用对定义文件所做的更改,请选择“Reload Definitions ”。

另请参阅 《如何:编辑代码》和《编辑代码》。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.