Search code examples
ruby-on-railssyntax-highlightingsublimetextsublimetext2guard

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?


Solution

  • 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