Joseph Crawford Using wordpress because he is lazy

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!

Comments (11) Trackbacks (0)
  1. This doesn’t seem to be working 100% in Intrepid (8.10 amd64) :(

  2. @Joseph
    Just tried to edit /usr/share/gtksourceview-2.0/language-specs/php.lang. It looks like around Line #30 there is this…

    <property name="globs">*.php;*.php3;*.php4;*.phtml</property>

    I modified it to look like this…

    <property name="globs">*.php;*.php3;*.php4;*.phtml;*.ctp</property>

    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 :-|

  3. @Joseph
    Okay I think I got it now. After doing all of the above I deleted:

    sudo rm -rf ~/.local/share/mime

    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 :-D

  4. U missed

    update-mime-database /usr/share/mime

    I think here

  5. 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.

  6. I wonder how to do this with gEdit in Windows…

  7. This is great, like this I can auto assign my .module and .inc files in drupal to gedit.

    gedit to the edit!

  8. The artical’s instructions just worked for me too! I added ‘*.module’ and ‘*.inc’ and now Drupal files look great! Ubuntu 11


Leave a comment

(required)

No trackbacks yet.