Can I set a default syntax highlighting in Gedit?

Solution 1:

You can at least add file extensions in the html syntax coloring scheme by editing html.lang in /usr/share/gtksourceview-2.0/language-specs/ as a super user. So say you want to add HTML syntax highlighting to cfm files, you'd change this

<property name="globs">*.html;*.htm</property>

(default html.lang) into this

<property name="globs">*.html;*.htm;*.cfm</property>

Solution 2:

You can create your own language definition files in your $HOME directory. Editing the gtk language specs is not recommended as it will be overriden by every gtksourceview update.

Copy your language specs file to your home directory:

$ cp /usr/share/gtksourceview-3.0/language-specs/html.lang ~/.local/share/gtksourceview-3.0/language-specs/

Then, add your custom file formats like .cfm to the list of extensions:

<property name="globs">*.html;*.htm;*.cfm</property>

That way gedit will use auto syntax highlighting on your custom file formats and gtk updates wont override your custom changes.