Add a file extension to gedit in Ubuntu
I needed .ctp files to open with PHP syntax highlighting in gedit. After searching around online for a while I found the answer on the ubuntu forums.
Add
<glob pattern="*.ctp"/>
to the
<mime-type type="application/x-php">
declaration in the /usr/share/mime/packages/freedesktop.org.xml file and then run:
update-mime-database /usr/share/mime
in the console. Restart gedit and now everything works great!













This doesn’t seem to be working 100% in Intrepid (8.10 amd64)
@Joseph
Just tried to edit /usr/share/gtksourceview-2.0/language-specs/php.lang. It looks like around Line #30 there is this…
I modified it to look like this…
but I am still having the problem.
gnomevfs-info shows that my .ctp file has the application/x-php mime type so I’m not sure what to do here. Maybe a restart will help
@Joseph
Okay I think I got it now. After doing all of the above I deleted:
And then rebooted. Not sure if I even needed to do a full reboot or not but hey it’s working now so I’m not going to question it
U missed
update-mime-database /usr/share/mime
I think here
Thanks for the tip. I’m trying to use gedit as my IDE to replace Eclipse, and I needed the File Browser pane to recognize .phtml files. This tip did the trick.