Creating your own syntax highlighting in GEdit?

主宰稳场 提交于 2019-11-26 18:06:26

问题


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");

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/766775/creating-your-own-syntax-highlighting-in-gedit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!