Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6960617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:25:29+00:00 2026-05-27T15:25:29+00:00

I recently started using Sublime Text 2. What an awesome editor. It does a

  • 0

I recently started using Sublime Text 2. What an awesome editor. It does a great job of highlighting Ruby code, but it does not highlight my Gemfile.

Is there a way to get it to do that?

I found this Gist but it has no instructions on how to use it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:25:29+00:00Added an answer on May 27, 2026 at 3:25 pm

    There are at least three options:

    1. Switch syntax manually (not preferred, but easy; no explanation required)
    2. Add "Gemfile" to the list of Ruby-syntax files
    3. Use the plugin you link to and create a package for it

    1. No explanation, but handy trick

    You can bind a keystroke to set syntax without moving to the mouse.

    I bound syntax changing to Ctrl-Opt-Space by adding the following to my user keybindings:

    [
      { "keys": ["ctrl+alt+space"], 
        "command": "show_overlay", 
        "args": { "overlay": "command_palette", "text": "Set Syntax: " } }
    ]
    

    2. Add "Gemfile" to list of Ruby-syntax files

    • Linux: ~/.config/sublime-text-2/Packages/Ruby/Ruby.tmLanguage
    • OS X: ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.tmLanguage
    • Windows: %APPDATA%/Sublime Text 2/Packages/Ruby/Ruby.tmLanguage

    You can also get there by using the menu option Preferences -> Browse Packages and going into the Ruby package. Once you’re in the file it’ll be obvious: it’s the <array> element with Ruby-looking filenames. Add <string>Gemfile</string> and you’re all set.

    It’s possible the setting could get overwritten on an upgrade; I’m not sure how that works with ST2–it may be cleaner to do it through code as in the snippet.

    3. Using the snippet you linked to

    More work (and the correction of one syntax error). You can either do it manually, by creating a directory in Packages (see above for location) or create an actual package and allow ST2 to install it.

    I created a test package called "Syntax" and copied the snippet into it, restarted ST2, and opening a Gemfile worked as expected. The correction required an additional colon (new gist), nutshell:

    elif name[-3] == "erb": # Needed a semi-colon here.
      set_sintax(view, "HTML (Rails)", "Rails")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started using lcov to visualize my code coverage. It's a great tool.
I have recently started using Vim as my text editor and am currently working
I recently started using Masterpages, the thing is I would like to add text
I recently started using SourceMonitor to review my (and others) code. Though I understand
I just recently started using this library (the one from CodePlex), but I ran
I have recently started using doc-view in Emacs, but I am having quite a
Ive recently started using Ruby on Rails for a project of mine and have
I've recently started using code coverage tools (particularily Emma and EclEmma), and I really
I've recently started using Ruby and was told to look into using RVM. I'm
I've recently started using Kiln Source Control for all my projects VB.NET code, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.