Is it possible to associate a particular custom syntax highlighting to files with a particular name? For example all files named "runfile" will be treated as programming language "foo".
Although it's somewhat counter-intuitive, Sublime Text treats filenames with no extensions the same way that it treats file extensions for the purposes of syntax detection. This is what allows it to associate the filename Makefile
with the appropriate syntax, for example.
As such, in order to set things up the way you want you just need to take the same steps that you would take to associate a particular extension in Sublime with a syntax, which is:
View > Syntax > Open all with current extension as...
from the menu (or click the current syntax name in the status bar) and select the appropriate syntax.Once you do that, the file should immediately be switched to the appropriate syntax if it wasn't already, and closing and reopening it should apply the correct syntax as well.
This works for any file that doesn't carry an extension, but gets unwieldy quickly if the names of those files change. In your particular case that doesn't matter because all files are named runfile
.
If you require this ability for a list of filenames (whether with an extension or not) that would require a plugin or add on package that catches the on_load
event and alters the syntax of the file.
There may or may not be such a package already on Package Control; ApplySyntax for example may be able to do this.