Is there a way to get TextMate to auto pick the file language based on the file path?
As an example, I have both matlab scripts and objective-c files each with ".m" extensions. When the path is .../matlab/... I would like them to use the Matlab language bundle otherwise use the Objective-C language bundle.
When I used to use emacs, I had a load hook that was able to parse the file path and use the correct mode.
Incidentally, I've added "firstLineMatch = '^[#%]+\s*.*[Mm]atlab.*';" to the Matlab language which works if I start the file with a '% Matlab' comment - this works for files I write, but not ones others write. Maybe there is a way to have a "filePathMatch = '.*/matlab/.*'" (or equivalent) in the language?
Thanks,
-- d
On 27.03.2008, at 03:59, Allan Odgaard wrote:
On 26 Mar 2008, at 18:41, dvlogic wrote:
Is there a way to get TextMate to auto pick the file language based on the file path? [...]
No, but more “per folder” settings are planned.
For such things I use the TMTOOLS plugin (http://email.eva.mpg.de/ ~bibiko/downloads/textmate/). You can parse the FILEPATH and set accordingly the language by using
"$TMTOOLS" set grammar '{to=Matlab;}'
Please note : This plug-in is strongly recommend to use for private scripting only!
--Hans