Until you save a document in gedit, syntax highlighting is turned off. There are obviously good reasons for this — people might get confused if certain words were randomly showing up in different colors. But for my purposes, I use gedit almost exclusively for HTML editing.
A lot of times I paste snippets of code into a new gedit document for quick editing, and I have to manually set the syntax coloring to HTML. Other times, I open ColdFusion (.cfm) documents, which gedit apparently doesn't recognize, and again I have to manually set the color to HTML. Both of these inconveniences would be fixed if I could find a way to tell gedit to automatically use HTML syntax highlighting for new documents and documents without a recognized file extension. Is this possible?
Best Answer
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>