Changing default syntax based on filename
In Sublime Text 2, I've seen ways of basing the syntax off of the extension. But what about a filename with no extension? For example, I often have a file called "Vagrantfile" which is in ruby, yet Sublime Text 2 always wants to start off in plain text. Is there a way to have it default to "ruby" for a file if it is called "Vagrantfile"?
With Sublime Text 2.0.1, build 2217, look in the lower right of the window, where it says "Plain Text" for the Vagrantfile that is open.
Click that and in the menu that opens, at the top, there will be an "Open all with current extension as ..." sub-menu. Go into that sub-menu and choose Ruby.
Even though the Vagrantfile has no extension, Sublime will remember this and open Vagrantfiles with the Ruby syntax as expected. This does not spread to all files with no extension.
Add the following line to the Syntax Specific - User file in
Preferences > Setting - More > Syntax Specific - User
for permanent staying of the syntax for every Vagrantfile file.
{
"extensions":
[
"Vagrantfile"
]
}