Like I mentioned in my issue on GitHub (https://github.com/textmate/bugs/issues/21), certain files wont persist syntax settings.
I made a quick screencast, where you see that after changing the syntax, closing the file and opening that same file again, the syntax setting has reverted.
Even though the fileType is reported as text.html.erb.rails (see screenshot)
My Global.tmProperties:
https://gist.github.com/koenpunt/a57e209ddb0ab0af119b59cc86bc90af
And my .tm_properties in my home folder:
https://gist.github.com/koenpunt/02dd3ab3670586216d40a9dacf42d3c3
Koen
Sent from [Nylas N1](https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz /local- 7e34bcbf-e984/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=), the extensible, open source mail client.
![](https://link.nylas.com/open/33wd9n5m5l3cdcz4d1oikbwcz/local- 7e34bcbf-e984?r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=)
On 11 Jul 2016, at 13:22, Koen Punt wrote:
I made a quick screencast, where you see that after changing the syntax, closing the file and opening that same file again, the syntax setting has reverted.
Open the file then use Bundle → Select Bundle Item… (⌃⌘T) and switch to settings (⌘}).
Now enter “filetype”, this should reveal what sort of file types are set for the current file.
When you change via status bar, it updates Global.tmProperties, but there could be local declarations which eclipse it.
That gives me just a single result, see attachment.
Sent from [Nylas N1](https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz/local-f9939871-26a8/0?...), the extensible, open source mail client.
![](https://link.nylas.com/open/33wd9n5m5l3cdcz4d1oikbwcz/local-f9939871-26a8?r=...)
On Jul 11 2016, at 1:25 pm, Allan Odgaard <mailinglist@textmate.org> wrote:
On 11 Jul 2016, at 13:22, Koen Punt wrote:
> I made a quick screencast, where you see that after changing the > syntax, > closing the file and opening that same file again, the syntax setting > has > reverted.
Open the file then use Bundle → Select Bundle Item… (⌃⌘T) and switch to settings (⌘}).
Now enter “filetype”, this should reveal what sort of file types are set for the current file.
When you change via status bar, it updates Global.tmProperties, but there could be local declarations which eclipse it.
textmate mailing list textmate@lists.macromates.com
[http://lists.macromates.com/listinfo/textmate%5D(http://lists.macromates.com...)
On 11 Jul 2016, at 13:57, Koen Punt wrote:
That gives me just a single result, see attachment.
OK, I assume the file has a <html> or <!DOCTYPE> tag on first line?
As a workaround you can edit the HTML grammar’s firstLineMatch (just clear it), and I think your issue will be fixed, but I will make a workaround for this in upcoming build.
> OK, I assume the file has a <html> or <!DOCTYPE> tag on first line?
That's correct, and I can work around it by just not closing the file for now :)
Thanks!
Sent from [Nylas N1](https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz /local- 9d1c2e76-2c54/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=), the extensible, open source mail client.
![](https://link.nylas.com/open/33wd9n5m5l3cdcz4d1oikbwcz/local- 9d1c2e76-2c54?r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=)
On Jul 11 2016, at 3:03 pm, Allan Odgaard <mailinglist@textmate.org> wrote:
On 11 Jul 2016, at 13:57, Koen Punt wrote:
> That gives me just a single result, see attachment.
OK, I assume the file has a <html> or <!DOCTYPE> tag on first
line?
As a workaround you can edit the HTML grammar’s firstLineMatch (just clear it), and I think your issue will be fixed, but I will make a workaround for this in upcoming build.
textmate mailing list textmate@lists.macromates.com
[http://lists.macromates.com/listinfo/textmate%5D(http://lists.macromates.com...)
Presumably related to this, was having similar issues. My custom settings for file types for different folders seemed to be the problem. I have the following:
[ "templates/{**/,}*" attr.untitled ] fileType = 'text.html.mustache'
[ "js/{**/,}*" attr.untitled ] fileType = 'source.js'
[ "scss/{**/,}*" attr.untitled ] fileType = 'source.scss'
[ "css/{**/,}*" attr.untitled ] fileType = 'source.css'
[ attr.untitled ] fileType = 'text.html.php.ko2'
Which I'm pretty sure was working at some point. But now the last option in the list is the one it uses for a new file, and it was also being used for any PHP files that I opened (so I re-ordered to make it last).
On Mon, 11 Jul 2016 at 20:00 Koen Punt koen@koenpunt.nl wrote:
OK, I assume the file has a <html> or <!DOCTYPE> tag on first line?
That's correct, and I can work around it by just not closing the file for now :)
Thanks!
Sent from Nylas N1 https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz/local-9d1c2e76-2c54/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=, the extensible, open source mail client. On Jul 11 2016, at 3:03 pm, Allan Odgaard mailinglist@textmate.org wrote:
On 11 Jul 2016, at 13:57, Koen Punt wrote:
That gives me just a single result, see attachment.
OK, I assume the file has a <html> or <!DOCTYPE> tag on first line?
As a workaround you can edit the HTML grammar’s firstLineMatch (just clear it), and I think your issue will be fixed, but I will make a workaround for this in upcoming build.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate http://lists.macromates.com/listinfo/textmate&r=dGV4dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 13 Jul 2016, at 9:47, George McGinley Smith wrote:
[…] I have the following:
[ "templates/{**/,}*" attr.untitled ] fileType = 'text.html.mustache'
This syntax should never have worked.
You need to either put a `.tm_properties` in each subfolder (templates, js, scss, and css) which has:
[ attr.untitled ] fileType = «file type»
Or if you don’t mind targeting *all* files in each subfolder, you can leave out the `attr.untitled`, e.g.:
[ templates/** ] fileType = 'text.html.mustache'
That said, it does seem like it would be nice to target both a file pattern and a scope selector, could possibly be done with `:` as separator, e.g.:
[ templates/**:attr.untitled ] fileType = 'text.html.mustache'
I will consider such extension for a future update.
P.S. The `{**,}/*` syntax is redundant and `**` should match the same (though this might not have been the case in earlier versions of TextMate’s file pattern matcher).
Okay, pretty sure it was working but perhaps each time I was editing and tested my .tm_properties it picked up the last one in the list as the new one and so I thought it was working when it probably wasn't.
FWIW:
[ templates/** ] fileType = 'text.html.mustache'
Only picks up for new files in subfolders. I have to do:
[ "templates{/**,}" ] fileType = 'text.html.mustache'
To make it work as desired. But yes, having the :attr.untitled syntax would be perfect for what I'm trying to achieve.
On Wed, 13 Jul 2016 at 12:45 Allan Odgaard mailinglist@textmate.org wrote:
On 13 Jul 2016, at 9:47, George McGinley Smith wrote:
[…] I have the following:
[ "templates/{**/,}*" attr.untitled ] fileType = 'text.html.mustache'
This syntax should never have worked.
You need to either put a .tm_properties in each subfolder (templates, js, scss, and css) which has:
[ attr.untitled ] fileType = «file type»
Or if you don’t mind targeting *all* files in each subfolder, you can leave out the attr.untitled, e.g.:
[ templates/** ] fileType = 'text.html.mustache'
That said, it does seem like it would be nice to target both a file pattern and a scope selector, could possibly be done with : as separator, e.g.:
[ templates/**:attr.untitled ] fileType = 'text.html.mustache'
I will consider such extension for a future update.
P.S. The {**,}/* syntax is redundant and ** should match the same (though this might not have been the case in earlier versions of TextMate’s file pattern matcher).
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 13 Jul 2016, at 13:53, George McGinley Smith wrote:
[ templates/** ] fileType = 'text.html.mustache'
Only picks up for new files in subfolders […]
My bad. The problem here is that for untitled files, we match the file pattern against the folder, and while `**/` will matching “nothing” the `/**` pattern must have a literal slash followed by potential nothing.
I will change this so that we use the folder with a trailing slash in the match when there is no filename.