Par*_*rto 9 gedit syntax-highlighting
按照我很久以前的问题,我仍在尝试调整我的财富处理能力。终端中的显示很棒,只剩下一件事 - 当我添加、编辑或删除个人财富时,Gedit 中的语法突出显示。
我的自定义财富文件采用以下格式:
Friend: "Whats a good movie?"
Me: "Snakes on a plane"
Friend: "Whats it about?"
Me: "Horses... horses on a boat..."
@AYYSIAN
%
Me on my wedding: you still like me, right?
@ComedyPosts
%
Mum: Son I'd love to meet your girlfriend...
Me: Me too...
@ComedyTruth
%
Doctor: "Ok, so what's wrong, how are you feeling?"
Me: *Looks at mum waiting for her to explain*
@ChildhoodFact
%
Friend: 75% of people are good at maths...
Me: Mmmmh, I guess then am in the remaining 18%...
@TheFunnyTeens
%
I loved the Titanic. My favorite character was the iceberg
@__GrumpyCat
Run Code Online (Sandbox Code Playgroud)
它基本上是a tweet,@name和%性格。然后重复。
当我在 Gedit 中打开它时,一切都是黑色的。
我正在寻找一种创建语法高亮文件的方法,该文件将把 the 转换%为类似 blue 的内容,将 the 转换为@name类似洋红色的内容。推文可以保持黑色。
笔记:
text/plain,只有给定的格式才能真正将它们与另一个纯文本文件区分开来。创建并打开您的财富语言文件:
sudo touch /usr/share/gtksourceview-3.0/language-specs/fortune.lang
sudo -i gedit /usr/share/gtksourceview-3.0/language-specs/fortune.lang
Run Code Online (Sandbox Code Playgroud)
粘贴以下内容:
sudo touch /usr/share/gtksourceview-3.0/language-specs/fortune.lang
sudo -i gedit /usr/share/gtksourceview-3.0/language-specs/fortune.lang
Run Code Online (Sandbox Code Playgroud)
确保它是可访问的:
<?xml version="1.0" encoding="UTF-8"?>
<language id="fortune" _name="Fortune" version="2.0" _section="Markup">
<metadata>
<property name="mimetypes">text/plain</property>
<property name="globs">*.</property>
</metadata>
<styles>
<style id="at" _name="@ sign" map-to="def:constant" />
<style id="percent" _name="percent sign" map-to="def:comment" />
</styles>
<definitions>
<context id="fortune">
<include>
<context id="at" style-ref="at">
<start>@</start>
<end>$</end>
</context>
<context id="percent" style-ref="percent">
<start>%</start>
<end>$</end>
</context>
</include>
</context>
</definitions>
</language>
Run Code Online (Sandbox Code Playgroud)
重启 gedit。
我的代词是他/他