Creating your own syntax highlighting in GEdit?

2019-01-10 21:11发布

How do you add a 'keyword' to the GEdit list of keywords? I basiclly want to make the printf function look like a keyword.

printf("Hello World\n");

2条回答
淡お忘
2楼-- · 2019-01-10 21:28

GEdit uses GtkSourceView for its syntax highlighting. You should be able to find the c.lang file it uses to highlight C code by typing a command like this:

$ locate gtksourceview | grep /c.lang

Once you find the lang file, open it up in a text editor (it's an XML file) and near the bottom you'll see a list of keywords which you should be able to add printf to.

查看更多
你好瞎i
3楼-- · 2019-01-10 21:37

Thanks to Jeremy's post I found this page: http://projects.gnome.org/gtksourceview/documentation.html

Here you'll find a link to both a tutorial and the official reference for the language definition files.

update: Another useful link http://wiki.gnome.org/Apps/Gedit/NewLanguage

查看更多
登录 后发表回答