Kate支持Vue的语法高亮
1, mkdir ~/tanker/.local/share/katepart5/syntax
2, 复制内容
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY name "[A-Za-z_:][\w.:_-]*">
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
]>
<language name="Vue" indenter="cstyle" version="1.0" kateversion="5.0" section="Scripts" extensions="*.vue" mimetype="text/html" author="Massimiliano Torromeo (massimiliano.torromeo@gmail.com)" license="LGPL">
<highlighting>
<contexts>
<context name="Start" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Find PUG" />
<IncludeRules context="Find HTML" />
<RegExpr attribute="Element" context="CSS" String="<style\b" insensitive="true" beginRegion="style" />
<RegExpr attribute="Element" context="Script" String="<script\b" insensitive="true" beginRegion="script" />
</context>
<!-- GENERIC -->
<context name="FindEntityRefs" attribute="Other Text" lineEndContext="#stay">
<RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
<AnyChar attribute="Error" context="#stay" String="&<" />
</context>
<context name="FindAttributes" attribute="Other Text" lineEndContext="#stay">
<RegExpr attribute="Attribute" context="#stay" String="&name;" column="0"/>
<RegExpr attribute="Attribute" context="#stay" String="\s+&name;" />
<DetectChar attribute="Attribute" context="Value" char="=" />
</context>
<context name="Value" attribute="Other Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="Value NQ">
<DetectChar attribute="Value" context="Value DQ" char=""" />
<DetectChar attribute="Value" context="Value SQ" char="'" />
<DetectSpaces />
</context>
<context name="Value DQ" attribute="Value" lineEndContext="#stay">
<DetectChar attribute="Value" context="#pop#pop" char=""" />
<IncludeRules context="FindEntityRefs" />
</context>
<context name="Value SQ" attribute="Value" lineEndContext="#stay">
<DetectChar attribute="Value" context="#pop#pop" char="'" />
<IncludeRules context="FindEntityRefs" />
</context>
<context name="Value NQ" attribute="Other Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
<IncludeRules context="FindEntityRefs" />
<RegExpr attribute="Value" context="#stay" String="/(?!>)" />
<RegExpr attribute="Value" context="#stay" String="[^/><"'\s]" />
</context>
<context name="El Close" attribute="Other Text" lineEndContext="#stay">
<DetectChar attribute="Element" context="#pop#pop#pop" char=">" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
<!-- END GENERIC -->
<!-- STYLE -->
<context name="CSS" attribute="Other Text" lineEndContext="#stay">
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="style" />
<DetectChar attribute="Element" context="CSS content" char=">" />
<IncludeRules context="FindAttributes" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
<context name="CSS content" attribute="Other Text" lineEndContext="#stay">
<RegExpr attribute="Element" context="El Close" String="</style\b" insensitive="true" endRegion="style" />
<IncludeRules context="##CSS" includeAttrib="true"/>
</context>
<!-- END STYLE -->
<!-- TEMPLATE lang="pug" -->
<context name="Find PUG" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Element" context="PUG" String="<template\s+lang=("|')pug("|')" insensitive="true" beginRegion="template" />
</context>
<context name="PUG" attribute="Other Text" lineEndContext="#stay">
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="template" />
<DetectChar attribute="Element" context="PUG content" char=">" />
<IncludeRules context="FindAttributes" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
<context name="PUG content" attribute="Other Text" lineEndContext="#stay">
<IncludeRules context="Find PUG" />
<RegExpr attribute="Element" context="El Close" String="</template\b" insensitive="true" endRegion="template" />
<IncludeRules context="##Pug" includeAttrib="true"/>
</context>
<!-- END TEMPLATE lang="pug" -->
<!-- TEMPLATE (default) -->
<context name="Find HTML" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Element" context="HTML" String="<template\b" insensitive="true" beginRegion="template" />
</context>
<context name="HTML" attribute="Other Text" lineEndContext="#stay">
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="template" />
<DetectChar attribute="Element" context="HTML content" char=">" />
<IncludeRules context="FindAttributes" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
<context name="HTML content" attribute="Other Text" lineEndContext="#stay">
<IncludeRules context="Find HTML" />
<RegExpr attribute="Element" context="El Close" String="</template\b" insensitive="true" endRegion="template" />
<IncludeRules context="##HTML" includeAttrib="true"/>
</context>
<!-- END TEMPLATE -->
<!-- SCRIPT -->
<context name="Script" attribute="Other Text" lineEndContext="#stay">
<Detect2Chars attribute="Element" context="#pop" char="/" char1=">" endRegion="script" />
<DetectChar attribute="Element" context="JavaScript content" char=">" />
<IncludeRules context="FindAttributes" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
<context name="JavaScript content" attribute="Other Text" lineEndContext="#stay">
<RegExpr attribute="Element" context="El Close" String="</script\b" insensitive="true" endRegion="script" />
<IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
</context>
<!-- END SCRIPT -->
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Other Text" defStyleNum="dsNormal" spellChecking="false" />
<itemData name="Element" defStyleNum="dsKeyword" spellChecking="false" />
<itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false" />
<itemData name="Value" defStyleNum="dsString" color="#a00" spellChecking="false" />
<itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false" />
<itemData name="Error" defStyleNum="dsError" spellChecking="false" />
</itemDatas>
</highlighting>
</language>
参考:
https://github.com/mtorromeo/kate-syntax-files?tab=readme-ov-file