20Dec/0811
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"></mime>
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!
January 24th, 2009 - 11:58
This doesn’t seem to be working 100% in Intrepid (8.10 amd64)
January 26th, 2009 - 12:22
@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
January 26th, 2009 - 14:35
@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
May 10th, 2009 - 09:23
U missed
update-mime-database /usr/share/mime
I think here
January 25th, 2010 - 06:59
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.
October 19th, 2010 - 11:10
I wonder how to do this with gEdit in Windows…
October 19th, 2010 - 11:20
gEdit in windows?
November 14th, 2010 - 14:39
Yes, Gedit in Windows
http://live.gnome.org/Gedit/Windows
November 14th, 2010 - 18:27
Sweet! I’ve been using Notepad++ for windows….not anymore
It was actually pretty simple to add extensions. I tested it on a Windows7 machine and all I had to do was edit the file:
C:\Program Files (x86)\gedit\share\gtksourceview-2.0\language-specs\php.lang
Around line 30 has the file extensions so you can just add whatever you want there and restart gedit. Worked like a charm.
October 20th, 2010 - 05:44
This is great, like this I can auto assign my .module and .inc files in drupal to gedit.
gedit to the edit!
November 22nd, 2011 - 16:04
The artical’s instructions just worked for me too! I added ‘*.module’ and ‘*.inc’ and now Drupal files look great! Ubuntu 11