Skip to content

Instantly share code, notes, and snippets.

@miguelsan
Created April 9, 2011 01:23
Show Gist options
  • Save miguelsan/911014 to your computer and use it in GitHub Desktop.
Save miguelsan/911014 to your computer and use it in GitHub Desktop.
slim.lang, a language_spec for syntax highlighting in gedit
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Miguel San Miguel contact at miguelsanmiguel dotcom
Based on 'haml.lang' by Ivan Kerin
-->
<language id="slim" _name="Slim" version="1.0" _section="Rails">
<metadata>
<property name="mimetypes">text/x-slim</property>
<property name="globs">*.slim</property>
<property name="line-comment-start">/ </property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="directive" _name="Directive" map-to="def:shebang"/>
<style id="tag" _name="Tag" map-to="def:keyword"/>
<style id="class-tag" _name="Class Tag" map-to="def:function"/>
<style id="id-tag" _name="Id Tag" map-to="def:identifier"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="error" _name="Error" map-to="def:error"/>
</styles>
<definitions>
<context id="line-comment" style-ref="comment">
<match>^( )*\/ .*$</match>
</context>
<context id="html-comment" style-ref="comment">
<match>^( )*\/! .*$</match>
</context>
<context id="directive" style-ref="directive">
<match>^( )*! .*$</match>
</context>
<context id="identation-error">
<match>^( ( )*)[^\s].*$</match>
<include>
<context sub-pattern="1" style-ref="error"/>
</include>
</context>
<context id="string" style-ref="string">
<match>^( )*\|.*$</match>
</context>
<context id="tags">
<start>^( )*</start>
<end>$</end>
<include>
<context id="erb-block" end-parent="true">
<start>=|-|~</start>
<end>$</end>
<include>
<context ref="ruby:ruby:*"/>
</include>
</context>
<context id="tag" style-ref="tag" once-only="true">
<match>%[a-zA-Z0-9\-\_]+</match>
</context>
<context id="id-tag" style-ref="id-tag">
<match>#[a-zA-Z0-9\-\_]+</match>
</context>
<context id="class-tag" style-ref="class-tag">
<match>\.[a-zA-Z0-9\-\_]+</match>
</context>
<context id="unclosed-brecket" style-ref="error">
<match>\}(?!{)</match>
</context>
<context id="erb-hash">
<start>{</start>
<end>}</end>
<include>
<context ref="ruby:ruby:*"/>
</include>
</context>
</include>
</context>
<context id="slim">
<include>
<context ref="line-comment"/>
<context ref="html-comment"/>
<context ref="directive"/>
<context ref="identation-error"/>
<context ref="string"/>
<context ref="tags"/>
</include>
</context>
</definitions>
</language>
@travishaynes
Copy link

I added this file to /usr/share/gtksourceview-2.0/language-specs/, selected slim highlighting in GEdit, but it didn't actually highlight for me. What else is required to get this to work?

@travishaynes
Copy link

got this to work. I just installed the gmate: https://github.com/gmate/gmate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment