Topic: problem with syntax highlighting of erb files in gedit

Hello all,

I'm using gedit on Ubuntu for coding and am quite happy with it. There's just one problem. Syntax highlighting for some .html.erb files doesn't work. It seems that's caused by the wrong MIME type MATLAB. How can I change this?

I found a comment on this page that described a solution. Unfortunately I don't get it ...

Adding

  <magic priority="20"&gt
   <match value="%" type="string" offset="0"/>
</magic>

into .htm.erb section of my /usr/share/mime/packages/rails.xml solved the problem for myself.

I don't have a rails.xml. How can I create one?

Thanks,

oerdec

Re: problem with syntax highlighting of erb files in gedit

Ok, just read through that page.

Now for clarification, Gedit has been included with the Gnome display enviroment for since it's inception practically. It uses GTK+ to do Syntax highlighting which is a system Library used for both Linux and Windows (for certain things like Pidgin and such).

What you will need to do is in Ubuntu, click on the Ubuntu menu in the upper left hand corner (default), then go to Accessories, and open Terminal. Then follow those commands he was talking about. Nano is a text based editor, accessible from the shell, which makes it handy for Linux admins to manage systems remotely without the pains of vi.

Anyway, so follow the commands, and use the arrow keys to navigate through the documents. Hit Cntrl+O to save the files, and Ctrl+X to exit nano. All the nano commands are listed conveniently at the bottom too.

Let me know if you have any questions about this.

Re: problem with syntax highlighting of erb files in gedit

You could also consider using Screem. It's been years since I've touched that, but last time I used it, it was an awesome IDE, and I think it's Rails compatible. I wasn't into Rails back then, so not sure, but would imagine so.

Just go into the Terminal and use apt to install it

sudo apt-get install screem -y

Re: problem with syntax highlighting of erb files in gedit

Thank you jmbrink26 for your replies.

I know how to create files using nano on the shell. The problem was I didn't have such a rails.xml file and didn't know how it should look like. Anyway, I found one and everything's fine. This is what I did a couple of minutes ago:

wget http://robzon.kapati.net/rails/rhtml.lang && sudo mv rhtml.lang /usr/share/gtksourceview-2.0/language-specs/
wget http://robzon.kapati.net/rails/rails.xml && sudo mv rails.xml /usr/share/mime/packages
sudo nano /usr/share/mime/packages/rails.xml

<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
        <mime-type type="text/rhtml">
                <sub-class-of type="text/html"/>
                <comment>RHTML Template</comment>
                <glob pattern="*.rhtml"/>
                <glob pattern="*.erb"/>
                <magic priority="20">
                         <match value="%" type="string" offset="0"/>
                </magic>
        </mime-type>
...

sudo update-mime-database /usr/share/mime

More info: http://grigio.org/pimp_my_gedit_was_textmate_linux

Cheers

oerdec

PS: Thanks for pointing me to Screem IDE. I'll have a look.

Re: problem with syntax highlighting of erb files in gedit

I am using Screem.  It has been improved a lot now and powerful also. Really it is an excellent IDE.
I don't whether it is compatible with Rails or not.

If you are interested check if it's compatible.

Re: problem with syntax highlighting of erb files in gedit

You could also consider using Screem. It's been years since I've touched that, but last time I used it, it was an awesome IDE, and I think it's Rails compatible. I wasn't into Rails back then, so not sure, but would imagine so
------------------------------------------------------
quang cao | quang cao online

Re: problem with syntax highlighting of erb files in gedit

oerdec, after you did all that, what does it look like now? is everything fully syntax highlighted? or only the <p>, <html> etc tags? Do the <% %> tags get highlighted as well?

I'm not sure if i did it right. thanks!

Re: problem with syntax highlighting of erb files in gedit

I wonder if you have any advices for me since I want to start a blog hosting but I don't really know how. I've been trying to search some forums on the internet but they haven't been too useful to me. Maybe u can give me a hand.
-----------------------
find exe files

Last edited by ankhkare (2010-07-26 18:53:19)

Re: problem with syntax highlighting of erb files in gedit

ankhkare wrote:

I wonder if you have any advices for me since I want to start a blog hosting but I don't really know how. I've been trying to search some forums on the internet but they haven't been too useful to me. Maybe u can give me a hand.

First of all that link is broken.

Secondly, that is in no way related to the rest of this post, you'd probably be much better off putting that in the 'general' section of the forums.

- Ben

Re: problem with syntax highlighting of erb files in gedit

Phil, checkout netbeans. Open source, free to use and like all good software platform independant.
http://netbeans.org/

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: problem with syntax highlighting of erb files in gedit

Let's use Vim

Giang, Nguyen Duc
Email: ndgiang84@gmail.com
Website: http://xiga.info
Please recommend for me on WorkingWithRails if you find my post useful: http://workingwithrails.com/person/1849 … -duc-giang

Re: problem with syntax highlighting of erb files in gedit

I recently downloaded the latest NetBeans and installed it. After creating my first Ruby project I am very impressed by Netbeans.

--------------------------------------------------------------
Irena @ cheap web hosting - ecommerce hosting

Re: problem with syntax highlighting of erb files in gedit

You could also consider using Screem. It's been age since I've touched that, but conclusion time I used it, it was an awesome IDE, and I think it's Rails compatible. I wasn't into Rails back then, so not sure, but would imagine so cheap web hosting ...

Re: problem with syntax highlighting of erb files in gedit

I want to start a blog hosting but I don't really know how. I've been trying to search some forums on the internet but they haven't been too useful to me. Maybe u can give me a hand.This is really nice blog.<a href="http://eurdupoint.com/">serial drama</a>

Last edited by asadkhan12 (2012-08-29 11:35:56)