Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2: How to set up consistent syntax highlighting for Guardfile?

While it is easy enough to set the language for a given (open) file in Sublime Text, I'm wondering if there is any way that I can tell the editor in advance that anything called "Guardfile" should be highlighted like it's Ruby code. Does anyone know how to do this?

like image 566
user456584 Avatar asked Aug 06 '12 03:08

user456584


2 Answers

The plugins recommended in the comments by Brian both do the job nicely:

  1. ApplySyntax
  2. SyntaxFromFileName

Update:

I couldn't get SyntaxFromFileName to match any of my regex for some reason. On the other hand, DetectSyntax comes with syntax highlight for the Guardfile built in.

Update2:

DetectSyntax has been renamed to ApplySyntax

like image 157
user456584 Avatar answered Oct 03 '22 22:10

user456584


Putting the following at the top of said file also works

#!/usr/bin/env ruby
like image 44
Gaveen Avatar answered Oct 03 '22 22:10

Gaveen