There are at least three options:
1. Switch syntax manually (not preferred, but easy; no explanation required)<br/>
1. Add `"Gemfile"` to the list of Ruby-syntax files<br/>
1. Use the plugin you link to and create a package for it<br/>
----
**1\. No explanation, but handy trick**
You can bind a keystroke to set syntax without moving to the mouse.
I bound syntax changing to <kbd>Ctrl-Opt-Space</kbd> by adding the following to my user keybindings:
<!-- language: lang-javascript -->
[
{ "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&ndash;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](
[To see links please register here]
)), nutshell:
elif name[-3] == "erb": # Needed a semi-colon here.
set_sintax(view, "HTML (Rails)", "Rails")